4

I've got my blog setup on a subpage (not the front page) and I'm using the template file home.php, how can I get the contents from the page editor onto this subpage?

If I change the title of the page it changes in the nav menu, but how can I get this to display on the page? (i.e. as the <h1> header)

8

Untested, but try:

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

But it's somewhat hackish. Really, the page_on_front and page_for_posts are intended to be nothing more than placeholders for the site front page and blog posts index page.

  • 1
    hackish, yes, but it works! – JKirchartz Apr 4 '12 at 17:44
  • you should add some conditional check for the front page, just in case you decide later to move the blog back on the front :) – onetrickpony Apr 4 '12 at 17:51
  • 1
    I don't think it's hackish as I'm sure that's what it was meant for. – Giraldi Aug 3 '14 at 4:02
  • 1
    This works too <?php single_post_title(); ?>. This is a bit awkward, but when you just need the title as string this works too. – toni_lehtimaki Feb 28 '17 at 20:56

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.