This code returns my WordPress menu:

 <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'header-menu') ); ?>

What's the easiest (non-JS) way of adding additional class to all .sub-menu ul dropdowns of this menu?

I was thinking about add_filter() for wp_nav_menu but I'm afraid it will point all wp_nav_menus and I want to add these classes only to this particular one. Also, custom walker sounds a bit like an overkill.

What would you recommend?

  • 1
    What is the purpose of this? Because WP already adds proper CSS classes for if a menu has child and or sub menu that has parent. If this is not what you're looking for and you need something more customized, then I am afraid custom walker is your best bet. – user23654 Aug 31 '13 at 14:53
  • This may help you stackoverflow.com/questions/5034826/… – Dejo Dekic Aug 31 '13 at 21:45
  • @splashingpixels - OOCSS. – Wordpressor Oct 23 '13 at 11:08

Your Answer

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

Browse other questions tagged or ask your own question.