I need to add <li>
separator after the anchor tag like this:
<li id="menu-item-27" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-27"><a href="services">Services</a></li>
<li class="separator>//</li>
<li id="menu-item-28" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-27"><a href="gallery">Gallery</a></li>
<li class="separator>//</li>
This is and old question but I stumble upon the same problem and solved it using a custom Walker.
First the walker adds a separator after each
<li>
on the top level:Then you can use
li:last-child
and hide the last separator or use a filter and remove it if you need ie7 support. Here’s my filter:Now you must use your walker as and argument for
wp_nav_menu
:Yes, a couple of different ways. Check the codex, but the following $arg’s will help.
Try