how to add class in li wp nav menu wordpress

Posted: August 7, 2015 in Uncategorized
Tags: , , ,

Hi all,

recently I just try to add class in li tag in wp nav menu.After some search I got this:

Filter Name : nav_menu_css_class

 

function li_class($classes, $item, $args) {
$classes[] = ‘YOUR_CLASS_NAME’;  // add our class name
return $classes;
}
add_filter(‘nav_menu_css_class’,’li_class’,1,3);

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s