WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. ronniebrown
    Member
    Posted 7 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
    Member
    Posted 7 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
    Member
    Posted 6 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

Tags

No tags yet.