WordPress.org

Support

Support » How-To and Troubleshooting » How to display page title, not the post title.

How to display page title, not the post title.

  • I have a News page which I have linked to my recent blog entries. I want to display the News title at the top of the page before showing the latest news entries however when I use the_title() it displays the title of the blog entry. I have seen the forum entries regarding using $post->post_parent and this does not achieve the desired result. What do I need to do?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Joni

    @jonimueller

    How have you “linked” the page? My suggestion is to make the change in the template itself until I can learn more about how you set this up.

    In Settings -> Reading, Front Page displays a static page.

    Front Page = Home.
    Posts Page = News.

    $post->post_parent just returns the ID of that page. Maybe: echo get_the_title($post->post_parent);

    If you’re trying to get the title outside the loop, wp_title() might do what your looking for.

    That doesn’t do the trick either. I’m at a loss, any more ideas?

    wp_title() does the trick. I hadn’t moved it out of the loop! Thanks for your help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to display page title, not the post title.’ is closed to new replies.