Answer the question
In order to leave comments, you need to log in
How to add custom li, a classes to wp_nav_menu?
The guys created their menu using:
register_nav_menus(
array(
'top-menu' => __( 'Top Menu', 'blankslate' ),
'bottom-menu' => __( 'Footer Menu', 'blankslate' )
)
);
wp_nav_menu(array(
'menu' => 'top-menu',
'theme_location' => 'Top Menu',
'depth' => 2,
'container' => 'ul',
'container_class' => ' ',
'menu_class' => 'top-menu',
'menu_id' => ' '
));
Answer the question
In order to leave comments, you need to log in
Well, either in Appearance -> Menu in the upper right corner, open Screen Settings, enable CSS classes and prescribe the necessary items, or select a filter.
For example try like this
add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2);
function special_nav_class($classes, $item){
$classes[] = 'your-custom-class';
return $classes;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question