WordPress.org

Forums

How to display page title, not the post title. (6 posts)

  1. churchill614
    Member
    Posted 3 years ago #

    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?

  2. Joni
    Member
    Posted 3 years ago #

    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.

  3. churchill614
    Member
    Posted 3 years ago #

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

    Front Page = Home.
    Posts Page = News.

  4. Big Bagel
    Member
    Posted 3 years ago #

    $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.

  5. churchill614
    Member
    Posted 3 years ago #

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

  6. churchill614
    Member
    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic