Created
November 26, 2012 01:32
-
-
Save javorszky/4146132 to your computer and use it in GitHub Desktop.
Adding extra classes to wp_nav_menu - part 4
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
<?php | |
function display_nav_menu_items( $items, $args ) { | |
foreach ($items as $item) { | |
if( $item->current ) { | |
$item->classes[] = 'active'; | |
} | |
} | |
return $items; | |
} | |
add_filter( 'wp_nav_menu_objects', 'display_nav_menu_items', 10, 2 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment