Created
November 12, 2017 18:49
-
-
Save isaacdanielanderson/0bb2716cf178157b7a143b53982458f3 to your computer and use it in GitHub Desktop.
Add an "Active" Class to current page in WP_NAV_MENU();
This file contains hidden or 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
// ======= Custom active class added to nav menu ======= // | |
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