I have created a custom post type: New Boats - the slug is new-boat
I have created a custom taxonomy related to this CPT: Boat Brands - the slug is boat-brands
I have a mega menu that lists all the Boat Brands (taxonomy titles). When I am on a New Boat CPT page, I need to show the related taxonomy title as 'active'. Is there a way to add the active taxonomy slug(s) to the menu classes dynamically?
I have tried numerous online 'solutions' but haven't got any to work yet.
Looking into the markup of the navigation menu items, I noticed that it adds a 'mega-current-menu-parent' class to the taxonomy link that is attached to the current post page.
You can use it in the custom CSS code, to highlight or differentiate like this:
( screenshot: hidden link )
.mega-menu-wrap ul.mega-menu li.mega-menu-item-type-taxonomy.mega-menu-item-object-boat-brands.mega-current-menu-parent:not(.mega-menu-item-has-children) a {
color: #0059a3 !important;
}
Thank you - I thought I had tried all the available classes but must have missed this one - I’m away for a few days but will test this on my return and let you know if this resolves it.