current_page_parent css class on menus with CPT
Closed this issue · 2 comments
I'm using Navi to build my main menu. In this menu there is the regular Blog menu and also a menu corresponding to a CPT.
The problem is when I'm on CPT single page, the Blog menu gets the current_page_parent
class.
So I googled and find that I can use this nav_menu_css_class
filter to remove the class current_page_parent
from the blog menu when I'm in a CPT.
This works fine when I render the menu with wp_nav_menu
, but if I use Navi, the blog menu keeps getting the current_page_parent
class.
Is there a way to handle this in Navi? Is Navi ignoring the nav_menu_css_class
filter or I need to do it some other way?
Maybe I'm missing something...
Thanks!
Is Navi actually having this class get passed to $item->classes
or is $item->active
just mistakenly true
?
If it's the first, I might have to change how the attribute map works slightly to allow for an array of classes to check for since that class shouldn't ever really come through to begin with.
If it's the latter, I'll have to look into this behavior but for now probably just do an check alongside $item->active
similar to whatever conditional you were using in the filter.
It's the first case, $item->classes
has the current_page_parent
class