How to display ONE specific WP post (ID inferred) from a specific category

There are many different explanations and guidelines when it comes to how to show ALL posts from a specific category in WP.

But I only want to show one (one) specific post (ID) from a specific WP category on the page.

Usage query_posts( 'p=31213' );

doesn't work.

Any idea?

+3


source to share


1 answer


You can use get_post if you want to get data for a single post.

Receive message with ID 7



$post_7 = get_post( 7 ); 
$title = $post_7->post_title;
echo $title;
echo "<pre>";
print_r($post_7);
echo "</pre>";

      

+1


source







All Articles