Support » Themes and Templates » Dynamic highlighting and grandchild pages

  • Hi folks, I’ve been trying to generate a dynamically populated menu which dynamically highlights the current page when you call up the parent page’s children and grandchild. So far I’ve got it working for child pages, but when I drop down to the grandchild level the highlighting goes away. Here’s the code I’m working with, any idea how I can tweak it to do what I want?

    <?php if (is_page()) { $highlight = "page_item"; } else {$highlight = "page_item current_page_item"; } ?>
    <ul><li class="<?php echo $highlight; ?>"><a href="<?php bloginfo('url'); ?>">Home</a></li>
    <?php wp_list_pages('sort_column=menu_order&title_li') ?></ul>

    Thanks a lot!

  • The topic ‘Dynamic highlighting and grandchild pages’ is closed to new replies.