• To have both a top-level page link and its subpage link highlighted dynamically, I’m using the solution described here: https://www.darrenhoyt.com/2008/02/12/creating-two-tiered-conditional-navigation-in-wordpress/

    I have a top-level horizontal menu, with subpages in custom sidebars for each top-level page. Some of those subpage menus are nested with two levels.

    The highlighting works great, except that when on a child-of-child page I would like for both levels of the subpage menu (ul ul li) to display in the sidebar with the current page highlighted. What I have is just the third level (ul li).

    Here’s the code:

    <?php if($post->post_parent)
    $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else
    $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");  
    
    if ($children && is_page()) { ?>
    <ul>
    <?php echo $children; ?>
    </ul>
    <?php } else { ?>
    <?php } ?>

    Help?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter david.danaan

    (@daviddanaan)

    Also, when on a child-of-child page the top-level parent link isn’t highlighted either, just the current page link.

    I tried adding various &depth= parameters, but nothing has worked so far.

    Thread Starter david.danaan

    (@daviddanaan)

    bump..

    There has got to be a ridiculously common solution to this – I’m just not proficient enough to see what it is. Many thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Dynamic menu highlighting with 3 levels’ is closed to new replies.