Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm working on a custom dropline menu using wp_nav_menu.

Using wp_nav_menu( array( 'theme_location' => 'primary', 'after' => '|' ) );, I can put separators after every item. However, I'm only wanting them after the child items in the sub-menu.

Is there any way I can be more specific about which items have separators, such that only the non-parent items are separated?


share|improve this question

3 Answers 3

up vote 1 down vote accepted

Why not use a purely CSS-based solution, using the :after pseudo-element? e.g.

#nav li li a:after {
    content: '|';
share|improve this answer
I completely forgot about using the "content" attribute. That's totally what I was looking for, thanks! –  aendrew Jul 22 '11 at 18:26

For a similar project, I used a single line of jQuery to selectively add spacers:

jQuery('ul#menu-main-menu-1 li.menu-item-267, ul#menu-main-menu-1 li.menu-item-265').append(' | ');

Leaving question open in hopes that somebody has a more elegant solution than this...

share|improve this answer

You can extend Walker class which wordpress uses for wp_nav_menu to style your menu in your way....

Here is an example...


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.