When viewing post pages, set the post archive page in the menu to current or current-menu-parent / current-menu-ancestor


When visiting any page, if that page is in the menu it is set to the current page.

Usually with post types, a desirable behaviour to ensure users know where they are within the site is the following:

Viewing any post page will result in the post type archive page menu item being set to current (as if the post page was a child of the archive page menu item).

In any cases where this didn’t happen automatically, using the standard WordPress menu we could use filters to ensure the classes were set appropriately.

With the Cwicly menu, this behaviour doesn’t happen and as far as we can tell, there is no way to filter the classes to achieve this.

Related feature request:

Step-by-step reproduction instructions:

  1. Create a blog page (post archive)
  2. Add it a menu
  3. Add the menu to a template (presumably a header)
  4. Create a post
  5. View the post on the website
  6. Notice the blog page menu item is not highlighted (set to current-menu-parent current-menu-ancestor or similar)

Any solutions about this?

I am looking at workarounds now - currently, until Cwicly allows filtering or @Louis comes up with a clever alternative, the only certain workaround is to use the WordPress menu instead, if this is important for your website.

Thanks…. Hooping that someone could find a fast solution for this :grinning:

The best way to solve it for the Cwicly menu is to vote for (and optionally comment on) this feature request and maybe also this one:

That way @Louis and the Cwicly team will know it is important to you as well and they can factor this in when prioritising updates.

Just confirming - as soon as the following feature request is added, we have code that will work for most use cases on most standard sites:

As of the this is now fully achievable. We have some fairly generic, re-usable code that enables this. We will share it here soon after we have tested it on a couple of sites.