Created
February 5, 2015 17:03
-
-
Save mauriciogofas/42d737701dbed83fb6e7 to your computer and use it in GitHub Desktop.
Righlight Current parent and child 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
<?php | |
//Righlight Current parent and child menu | |
add_filter('nav_menu_css_class', 'add_active_class', 10, 2 ); | |
function add_active_class($classes, $item) { | |
if( in_array( 'current-menu-item', $classes ) || | |
in_array( 'current-menu-ancestor', $classes ) || | |
in_array( 'current-menu-parent', $classes ) || | |
in_array( 'current_page_parent', $classes ) || | |
in_array( 'current_page_ancestor', $classes ) | |
) { | |
$classes[] = "current-menu-item"; | |
} | |
return $classes; | |
} | |
//END Righlight Current parent and child menu |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment