0

I am using a custom child theme with Genesis Framework.

I am not trying to replace the default menu with my own, I only wish to add a custom class name to the existing element, which currently displays header right (since my menus is in the the header right widget).

How can I go about achieving this? I have tried using the nav_menu_css_class filter in my child's function.php file without success.

Milap
  • 6,915
  • 8
  • 26
  • 46
Escendrix
  • 33
  • 4

1 Answers1

0

Each menu you create in WordPress will apply that menu name as the ID preceded by menu. So if you have a menu named Top Menu the id of that UL would be menu-top-menu so the UL would look like this <ul id="menu-top-menu" class="menu". You could target the menu using the ID.

Alternately, if you create a menu called 'Top Menu', you could call it directly in a theme file using wp_nav_menu. Using this technique will allow you to add a class. In the example below I am adding a class called top-menu.

wp_nav_menu( array('menu' => 'Top Menu', 'menu_class' => 'top-menu' ));
Matt Whiteley
  • 476
  • 2
  • 9