Skip to content

Instantly share code, notes, and snippets.

@javorszky
Created November 26, 2012 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javorszky/4146132 to your computer and use it in GitHub Desktop.
Save javorszky/4146132 to your computer and use it in GitHub Desktop.
Adding extra classes to wp_nav_menu - part 4
<?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