Home › Forums › Other › Custom Post type and WP Nav menus – Active State › Reply To: Custom Post type and WP Nav menus – Active State
June 3, 2014 at 1:33 pm
#171701
Participant
This was very handy, thanks for posting. I did streamline it a bit:
// custom nav highlighting for various pages
function fb_custom_nav_highlights($classes) {
if (is_singular('video') && in_array('nav-watch-now', $classes)) {
$classes[] = 'current-menu-item';
} elseif (is_singular('post') && in_array('nav-whats-new', $classes)) {
$classes[] = 'current-menu-item';
}
return $classes;
}
if (!is_admin()) { add_filter('nav_menu_css_class', 'fb_custom_nav_highlights'); }