I'm assuming the following:
- You're using a Static Front Page
- You have a separate static page assigned to display the blog posts index
- You have created the
home.php
template file in your Theme
- The static page assigned to display the blog posts index is titled Blog
- 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.
home.php
is template name reserved for home page, if you are trying to use it for named page template it will likely conflict.