Created
February 19, 2018 18:43
-
-
Save govindak/0bb2dfca6d9204b641138505e207b409 to your computer and use it in GitHub Desktop.
add active class wp menu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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