Grandchildren menu replaces children menu? (1 post)

  1. Kettercat
    Posted 3 years ago #

    Okay, I seem to have a problem with my grandchildren (third) menu - when I click on one of the grandchildren pages, the menu replaces the children (second) menu.

    As seen here -
    Try clicking on one of the subpages, it goes on top.

    This is the code:

    <ul id="subnav">
    <?php if($post->post_parent)
    $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&depth=1"); else
    $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0depth=1");  
    if ($children && is_page()) { ?>
    <?php echo $children; ?>
    <?php } else { ?>
    <?php } ?>
    <ul id="grandnav">
    $grandchildren = wp_list_pages("title_li=&child_of=&child_of=".$post->ID."&echo=0depth=2");
    if ($grandchildren && is_page()) { ?>
    <?php echo $grandchildren; ?>
    <?php } else { ?>
    <?php echo $grandchildren; ?>
    <?php } ?>

    What am I doing wrong?

Topic Closed

This topic has been closed to new replies.

About this Topic