Support » Themes and Templates » How to get the page parent

  • I’m trying to get the page parent of a page. I need this for show in the navigation only the pages that have no parents.

    I saw that “$page_title = $page->post_title;” code returns the page title. But, how can I return the page parent and test if it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try this:

    <?php

    $toto = get_the_title($post->post_parent);
    if(get_the_title($post->post_parent) != the_title(‘ ‘ , ‘ ‘,false))
    {
    echo $toto;
    }
    ?>

    Yea, but how do we get the ID?

    This seems to be the untalked about enigma of wordpress.

    when and where is the is_subpage function going to appear?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get the page parent’ is closed to new replies.