I searched high and low for a solution to this problem of ‘blog’ being highlighted in the menu in addidtion to my CPT menu item.
Not sure if anyone else has already tackled this, but I’ll post here.
I found this gem on GitHub:
I put these bits:
// Get post_type for this post $post_type = get_query_var('post_type'); // Removes current_page_parent class from blog menu item if ( get_post_type() == $post_type ) $classes = array_filter($classes, "get_current_value" );
into the top of the “roots_nav_menu_css_class” function in roots/lib/nav.php
And added the “get_current_value” function above the “roots_nav_menu_css_class” function.
The rest of the “roots_nav_menu_css_class” function remains untouched.
This works for me now, but I’m not sure if there is a cleaner way to do it, e.g. adding it to roots’s custom.php as an override.
I’m really interested in hearing feedback on this, or if anyone handled this issue in another way.