loading...

WP-nav-active and dropdown filter

Category: WordPress
//----------------------------------------------------------------------
//  Add a pingback url auto-discovery header for single posts, pages, or attachments.
//----------------------------------------------------------------------
function ic_change_active_nav_class ($classes, $item) {
   if (in_array('current-menu-parent', $classes) ){
       $classes[] = 'active ';
   }
   if (in_array('current-menu-item', $classes) ){
       $classes[] = 'active ';
   }
   if (in_array('menu-item-has-children', $classes) ){
       $classes[] = 'ic-dropdown ';
   }
   return $classes;
}
add_filter('nav_menu_css_class' , 'ic_change_active_nav_class' , 10 , 2);