Display Page Title (NOT Post Title) (3 posts)

  1. ronniebrown
    Posted 9 years ago #

    I have (in page.php) a section where I want to display the page title in an <h2> tag, but also its parent page, in an <h1> tag.

    How do I get the parent name to display based on whatever page it's currently displaying?

  2. converting2wp
    Posted 9 years ago #

    This should do what you're asking --

    $parent_title = get_the_title($post->post_parent);
    echo $parent_title;

    To find out if a page is top-level check to see if $post->post_parent is 0.

  3. gspark
    Posted 8 years ago #

    is there away to use this to pull the link as well ?

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.