Skip to content

Instantly share code, notes, and snippets.

@govindak
Created February 19, 2018 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save govindak/0bb2dfca6d9204b641138505e207b409 to your computer and use it in GitHub Desktop.
Save govindak/0bb2dfca6d9204b641138505e207b409 to your computer and use it in GitHub Desktop.
add active class wp menu
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment