Support » Fixing WordPress » dynamic menu highlighting with a unique problem/twist

  • Hi,

    Have a tricky problem I can’t solve, hoping someone can help. I’m trying to dynamically highlight the parent menu item based on what child submenu item is selected below it. Also, if a post is selected under the subcategory, I’d like the top level parent menu item to stay highlighted.

    But here’s the unique problem/twist: the template I’m using has the top level parent item a non-link and not a category, and the submenu items are the categories.

    Here’s that code from my header:

        			<?php wp_list_categories("exclude=$blog_ID&title_li="); ?>

    So in this scenario, when you roll over “Work” in the menu, work is not clickable, but you get a drop down submenu with clickable category links, like interactive, email, print, etc. That’s just how the template I’m using is set up.

    I know how to make the single Home, About and Contact pages dynamically highlight, here’s the php and css I’m using for those:


                    if (is_page('About'))
                    echo " id=\"current\"";
                    <a href="<?php bloginfo('url') ?>/about">About</a>


    #current a {font-weight:bold;color:#e2007d;}

    I’ve played around with the “Work” parent and submenu and have it partially working, but now when a child submenu item is selected, all of the child submenu items stay highlighted…you’ll see the problem here on my test site:

    Again, it should be that only the parent menu item, “Work,” stays highlighted when one of the child submenu items OR one of the posts belonging to the particular submenu child is selected. I hope that’s clear.

    Any help would be appreciated.


  • The topic ‘dynamic menu highlighting with a unique problem/twist’ is closed to new replies.