Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to add .active class to active menu item

<?php
add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2);
function special_nav_class($classes, $item){
     if( in_array('current-menu-item', $classes) ){
             $classes[] = 'active ';
     }
     return $classes;
}
Source by developer.wordpress.org #
 
PREVIOUS NEXT
Tagged: #How #add #class #active #menu #item
ADD COMMENT
Topic
Name
1+9 =