Add a custom CSS class to wp_nav_menu

Adding this snippet to the functions.php of your wordpress theme will add a custom class to the wp_nav_menu navigation within your wordpress theme.

 

 

function custom_nav_class($classes, $item){
$classes[] = “custom-class”;
return $classes;
}
add_filter(‘nav_menu_css_class’ , ‘custom_nav_class’ , 10 , 2);

Be Sociable, Share!

Leave a comment