How can I have a static title on my blog page?

My blog page is not my homepage. How can I add a title to the top of the page? i.e. “My Blog”. Right now there is no title on the page. The title of the first post is at the top. (Sorry it’s on my local machine or I’d provide a link and I’m too new to post an image.)

Things I’ve tried:

  • Creating a “blog” template page. It didn’t work because the blog
    always uses index.php. (Thanks to Rev. Voodoo for the code that
    helps you see which template is used.)
  • There is a similar question on stackexchange but it’s not really
    answered and I don’t understand it.

Thank you!

2 Answers
2

the accepted answer in the similar question on stackexchange should work;

try to add this to a suitable location in index.php of your theme:

<?php if( is_home() && get_option( 'page_for_posts' ) ) echo get_the_title( get_option( 'page_for_posts' ) ); ?> 

Leave a Comment