I have the following html on my menu section:
<nav class="navigation">
<ul>
<li class="active-menu">Home</li>
<li>About
<ul class="submenu>
<li class="sub-item">Our History</li>
<li class="sub-item">Our Goal</li>
</ul>
</li>
<li>Contact</li>
</ul>
</nav>
Now I am planning to add 2 things here: one is the active-menu
class if the item click is the active one and then add classes namely submenu
and sub-item
to the submenu that were set at the WordPress Menu Dasbhoard.
So far I have the following code:
<?php wp_nav_menu(array(
'theme_location' => 'headerMenuLocation'
)); ?>
How do I customize my wp_nav_menu
in order to add these classes?
Thank you in advance.
2
Answers
you have to add your customize clsses in ‘menu_class’.
You can use the add_filter function for class add to li tag