WordPress.org

Ready to get started?Download WordPress

Forums

How to get the page parent (3 posts)

  1. klebersoftgroupcombr
    Member
    Posted 8 years ago #

    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?

  2. gbouchar
    Member
    Posted 8 years ago #

    Try this:

    <?php

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

  3. moody
    Member
    Posted 8 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags