OK so i have a main menu and a sub-menu
How can i make a menu item active when viewing a single post.
The sub-menu uses taxonomies so i know i need to make the taxonomy active when one of the posts has the taxonomy in use
|
OK so i have a main menu and a sub-menu How can i make a menu item active when viewing a single post. The sub-menu uses taxonomies so i know i need to make the taxonomy active when one of the posts has the taxonomy in use |
|||||||||||
|
|
have a read of this codex: http://codex.wordpress.org/Dynamic_Menu_Highlighting |
|||
|
|
So i ended up doing some jquery and lots of it. The downside is that i have to add the code each time i create a new menu. I am looking into re-creating this but do not want to bother with it right now. This is the link to the solution. It is very very temporary so if you wish to use it go ahead but there are better ways. You may be able to hook into the wp_nav_menu classes and add a active class to the current active item and then use some jquery to finish it off. |
|||
|
|
|
I did something similar with highlighting current category in navbar, you can see my answer here. The hook of course won't work for you, I think a better hook would be 'nav_menu_css_class' |
|||||||||
|