Skip to content

Instantly share code, notes, and snippets.

@PaulGwamanda
Created November 16, 2017 12:15
Show Gist options
  • Select an option

  • Save PaulGwamanda/ac643651c26f653c5d19a83ae183284f to your computer and use it in GitHub Desktop.

Select an option

Save PaulGwamanda/ac643651c26f653c5d19a83ae183284f to your computer and use it in GitHub Desktop.
Add active menu class - wordpress
function special_nav_class ($classes, $item) {
if (in_array('current-menu-item', $classes) ){
$classes[] = 'active';
}
return $classes;
}
add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment