WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 0 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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