How to add a class to wp_nav_menu output current_item $id
-
Hello WordPress Community,
I’m currently coding a theme and trying to change the output of wp_nav_menu. At the end of the class I need something like “current_menu_item + $id (of menu item)”.
Here is an example:
My code before<div id="mainmenu" class="navigation"> <ul id=\"menu-main\" class=\"menu\"> <li id="menu-item-170" class="menu-item menu-item-type-taxonomy menu-item-object-category current-menu-item menu-item-170"><a title="2" href="https://127.0.0.1/wp/?cat=17">Comedy</a></li> </ul> </div>
and this is what i want to get:
<div id="mainmenu" class="navigation"> <ul id=\"menu-main\" class=\"menu\"> <li id="menu-item-170" class="menu-item menu-item-type-taxonomy menu-item-object-category current-menu-item menu-item-170 current-menu-item-170"><a title="2" href="https://127.0.0.1/wp/?cat=17">Comedy</a></li> </ul> </div>
So i need a simple current-menu-item-170 at the end.
So my question is how to do that.
I tried a bit around with function start_el.
Thanks in advance.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to add a class to wp_nav_menu output current_item $id’ is closed to new replies.