WordPress.org

Forums

Grandchildren showing under wrong parent (2 posts)

  1. Kburrows
    Member
    Posted 10 months ago #

    I have a side menu that allows me to have a different color for each parent with children underneath. I recently had to add grandchildren to one of the children. While I have it working to show the grands only when the parent is clicked, they all show up at the end of the last child instead of under the correct child. Confused? Me too. Here is the code

    <?php //wp_list_pages('include=22&title_li=' ); ?>
    
    <li class="page_item page-item-22 green"><a href="http://slpcommunityed.com/birth-five/">Birth - Five</a></li><span class="leftTriangle">  </span>
    
    <?php if(is_page(22) || in_array(22,$ancestors) ) {
    
    $children = wp_list_pages("title_li=&child_of=22&echo=0&depth=1");
    
    if($children){echo "<ul class=\"green\">".$children."</ul>";}
    
    } ?>
    
    <?php if(is_page(2678) || in_array(2678,$ancestors) ) {
    
    $children = wp_list_pages("title_li=&child_of=2678&echo=0&depth=1");
    
    if($children){echo "<ul class=\"grand\">".$children."</ul>";}
    
    } ?>
    
    <?php if(is_page(2670) || in_array(2670,$ancestors) ) {
    
    $children = wp_list_pages("title_li=&child_of=2670&echo=0&depth=1");
    
    if($children){echo "<ul class=\"grand\">".$children."</ul>";}
    
    } ?>

    Enrichment should have aquatics etc beneath it.

    Any help would be appreciated, I would hate to have to reinvent the wheel on this.

  2. Kburrows
    Member
    Posted 9 months ago #

    Any help here?

    I should have posted that the grandchild is showing up under the wrong child.

    thanks

Reply

You must log in to post.

About this Topic