• Heys guys.. i have a bit of problem… I use this script below to use class active for all my menu items. All is working gr8. But problem is that first menu item has class .first:hover and first-active and its a bit different when active then rest of menu items. I added his classes in css box in menu editor… But problem is that when active all items use that “active” css… Point is i was all items to use “active”,and only first menu item to use other classes. Can som1 help me edit this script?
    Ty

    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;
    }

  • The topic ‘Adding different classes to wordpress menu items’ is closed to new replies.