Highlight Current Menu Item For CPT Single pages

How can I apply the “current state” to buttons in the main menu when a user visits a custom post type single page?

Commonly available code snippets don’t seem to work in Cwicly.

I know that this has been discussed in other threads but it doesn’t seem that there is a solution for this request. Is there a workaround to achieve this? Thanks!

Hi @Alexander,

Please see:

You may also find this interesting:

Thank you. Yes, I saw those posts but I have no idea how to interpret it.

Is there already a way to achieve this or if this is something the Cwicly team is working on :slight_smile:

I can help you do what you want, I just need a bit more information first so I know exactly what you are wanting to achieve.

Please confirm the following:

  1. Are you wanting to show a different style for the post archive menu item associated with the visited post?
  2. Are you wanting to show a different style for the post category/custom taxonomy term menu item associated with the visited post?
  3. Are you wanting to show a different style for the post menu item associated with the visited post?

As soon as I know these answers, I can share with you the method we use to do this.

I really appreciate your help! Unfortunately, I am having a hard time answering your questions.

This is what I try to accomplish:

  1. I have a main menu item called “Work”.
  2. When a user clicks on “Work” it will lead to the work archive page (CPT Archive) and the main menu item button “Work” is blue.
  3. Clicking on a specific project will lead to the project detail page (CTP single)
  4. Goal: Having the main menu item button “Work” blue when a user visits any of the CPT single pages. Currently the button “Work” is black instead of blue

Sorry for the long explanation. Please let me know if you need more information from me.

You have given all of the information I asked for.

One final question, are you using:

  1. a Menu block
  2. a Nav block
  3. a Nav block containing a Menu block

I am using the menu block provided by Cwicly.

Screenshot 2024-08-20 at 21.01.35

Hi StrangeTech,

Following up our conversation from last week. Did you get a chance yet to look into my issues highlighting menu items for single CPT pages?

Thanks.

Hi @Alexander,

Please see this tip:

I hope this gives you exactly what you need.