Add active class for wordpress menu

,
Add the following code in your functions.php file


add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2);

function special_nav_class ($classes, $item) {
if (in_array('current-menu-item', $classes) || in_array('current-menu-parent', $classes)){
$classes[] = 'active ';
}
return $classes;
}

Related Post


Latest Post


Recent Posts Widget

Make sure to never miss a thing...

Get the latest news from the creative industry along with other creative goodies, conveniently delivered to social media.