WordPress.org

Ready to get started?Download WordPress

Forums

get_pages (2 posts)

  1. obidos
    Member
    Posted 1 year ago #

    Hi all,

    This is my structure. So I have 3 levels navigation.

    parent > children > grandchildren

    I want to call all the children from the parent page. But not the granschildren. So just a depth of 1. However depth does not work with get_pages.

    Here is my code:

    $args = array(
    'child_of' => $post->id,							  'depth'  => 1,							  'sort_column' => 'menu_order'
    );
    
    $children=get_pages($args);

    This gets all the child and granschild pages of the page I am on (I am on the parent page).

    I just want the children.

    If I add

    'parent' => 0,

    That shows all the parent pages. So the 1st level navigation.

    If I add

    'parent' => 1,

    That shows nothing.

    If I add

    'depth' => 1,

    That does not do anything.

    Any ideas kind people?

  2. vtxyzzy
    Member
    Posted 1 year ago #

    The parameter 'parent' needs the ID of the parent page, not just a 1.

Topic Closed

This topic has been closed to new replies.

About this Topic