add active class to current page in “menu” with two menus

I currently have a filter setup for nav_menu_css_class for active menu, I have two menus at the top I am using, because the first couple tabs are feature tabs so they are a different color, therefor I have two “wp_nav_menu” to accomplish this. That part is working fine. And I have the following code setup for the active tab, but I need a way I can use a different class for both the menus when active. Both menus have a different class for when active. REF: my “feature_current” is my active class, and the other one will just be “current”.

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[] = 'feature_current';
  }

  return $classes;
}

Related posts

Leave a Reply