Skip to content

Instantly share code, notes, and snippets.

@webmasterninjay
Created February 21, 2015 08:25
Show Gist options
  • Save webmasterninjay/7bd32724c039cce1838a to your computer and use it in GitHub Desktop.
Save webmasterninjay/7bd32724c039cce1838a to your computer and use it in GitHub Desktop.
WP filter function to add class on nav's current page
<?php
function jay_nav_class($classes, $item){
if( in_array('current-menu-item', $classes) ){
$classes[] = 'selectedLava';
}
return $classes;
}
add_filter('nav_menu_css_class' , 'jay_nav_class' , 10 , 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment