Here is my html for the menu:

<div id="main-menu-container">
                <ul id="main-menu">
                <li><a href="#"><span aria-hidden="true" class="icon-home"></span>Home</a></li>
                <li><a href="#"><span aria-hidden="true" class="icon-briefcase"></span>Portfolio</a></li>
                <li><a href="#"><span aria-hidden="true" class="icon-cog"></span>Services</a></li>
                <li><a href="#"><span aria-hidden="true" class="icon-download"></span>Freebies</a></li>      
                <li><a href="#"><span aria-hidden="true" class="icon-user"></span>About</a></li>                 

& the wp code:

 'theme_location' => 'primary',
'container_id' => 'main-menu-container',
'menu_id' => 'main-menu',

As you can see, the problem is I have different span class added to each list item. & I can not use link_before & link_after. I have no idea how to add them in wp_nav_menu.

How can I solve this?


If you want to add different classes to each menu, you can do that by JS. In JS just add a array, where you should save corresponding menu and it's class. and run a each loop to add classes to menu.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.