How to display the page title/content in the Posts page?

I’m assuming the following:

  1. You’re using a Static Front Page
  2. You have a separate static page assigned to display the blog posts index
  3. You have created the home.php template file in your Theme
  4. The static page assigned to display the blog posts index is titled Blog
  5. You have added some post content to this static page

Because of the special, reserved nature of home.php, and also for page_for_posts, you cannot use the normal methods to access the $post object for the Blog static page. You can, however, retrieve the post title and post content for this page. The key is to reference the post ID via get_option( 'page_for_posts' ).

Page Title

Use get_the_title():

echo apply_filters( 'the_title', get_the_title( get_option( 'page_for_posts' ) ) );

Page Content

Use get_post_field():

echo apply_filters( 'the_content', get_post_field( 'post_content', get_option( 'page_for_posts' ) ) );

In both cases, wrap the output in an apply_filters() call, so that the post title and post content are rendered the same as they would be normally. Otherwise, the data returned via get_the_title() and get_post_field() would lack the usual formatting that WordPress applies via the_title() and the_content(), respectively.

Leave a Comment