View All Posts

Show a specific Page/Post content in your template.

Sometimes you need to display a specific page or single post content in an area on your site or templates. Here is one method that has worked great for me.

$post_id = 2509;
$queried_post = get_post($post_id);
$content = $queried_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);
echo $content;

You can get the PAGE ID here:


Posted: July 12th, 2016
Updated: July 20th, 2016

Category: Snippets
Tags: ,