Skip Navigation

[Resolved] Add the active taxonomy slug to the menu when viewing a related custom post type

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#2603391

BD

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.

#2603893

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

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

#2604413

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

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;
}

#2605523

BD

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.

#2605557

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

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.

#2606995

BD

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.