Last active
December 27, 2015 00:59
-
-
Save jeremyfelt/7241831 to your computer and use it in GitHub Desktop.
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 | |
| // $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) ); | |
| add_filter( 'nav_menu_css_class', 'wsuspine_fix_nav_item_classes', 10, 3 ); | |
| function wsuspine_fix_nav_item_classes( $classes, $item, $args ) { | |
| if ( in_array( 'current-menu-item', $classes ) ) | |
| return array( 'current' ); | |
| return array(); //should return an empty array of classes. | |
| // return array( 'my-custom-class' ); // returns a custom array of classes | |
| } |
For my own reference: http://codex.wordpress.org/Plugin_API/Filter_Reference/nav_menu_css_class
Beautiful! That's it. Can't I give you a brownie point like on stack overflow? Shame.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So, this is close. It's eliminating all the extra classes but failing to return .current on the current menu item.