2

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!

  • What do you mean by top of the page? you mean a browser title? or just on the page as text? -- also what theme are you using? quick answer for both. If you want some sort of static text to display. You can edit your theme's .php files. Like, index.php, page.php etc to be found in wp-content/themes/yourtheme/... If you have basic html knowledge that shouldn't be a problem to locate where. if it is the actual browser title look for the <title></title> tag, although you should be able to change that in your adminpages for most themes. Do give some more details on what exactly you are trying, or w – woony Jul 31 '12 at 11:32
4

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' ) ); ?> 
0

I discovered <?php single_post_title(); ?> that works for both blog title and for other pages without any modifications. :)

So you can use it on the top of the page, and also in the page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.