I am currently using wp_nav_menu to generate my nav menu. Although everything is working and menu highlighting is working, how do you get child pages to be highlighted as well?
For example, I have a menu item named "Page" and it has 3 child pages under that. So when I am in any of the child pages, I want the main Page to still be highlighted...how is that possible with using wp_nav_menu..?
Wordpress will give the current page the class 'current-menu-item' so just add the css you want to that. e.g.
Edit:- You can target the child menu items with
Edit2:- Use this to hilight the parent menu item when on a sub page
The
body_class
function which WordPress has can help you out here.http://codex.wordpress.org/Function_Reference/body_class
What you'll want is
current-menu-parent
which you can utilise in your CSS. Not particularly well documented as far as I can tell, but this article helps:http://www.designisphilosophy.com/tutorials/highlight-current-page-or-category/