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.
Thanks.
Hi,
Thank you for contacting us and I'd be happy to assist.
To suggest a solution for this, I'll need to see how this single post page and the menu items are set up in the admin area.
Can you please share the temporary admin login details, along with the link to an example New Boat CPT page?
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
regards,
Waqar
Thank you for sharing the access details.
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.
You're very welcome and take your time.
Please, let me know if you have any follow-up questions, and for a new question or concern, feel free to start a new ticket.
My issue is resolved now. Thank you!