Show Specific Post in WordPress Theme

Hello Friends, how are you?
Now I am going to tell how to show a specific post in specific page of wordpress theme. Suppose, I have a page entitled ‘page-forum.php’ and I want to show a specific post into this page. The code are below-

<?php

$post_id = 26;      //identify the no of the post
$queried_post = get_post($post_id);
$title = $queried_post->post_title;    //taking the page title specificly
echo $title;     //print out the page title
echo $queried_post->post_content;    //print out the content

?>

In this case, I use the 26 for post id. You can use any thing according to your post ID. Thanks for reading this post.

Take care, Bye bye

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s