Active Menu item when viewing a CPT

I have been using Roots since v1 so we go way back and I just love it. I am now using it for my latest project.

I have a “Projects” Custom Post Type. Now when I view the Archive/list view for my Project CPT, Roots is adding the active class to my Header Menu for both my Blog menu item and also my Projects menu item.

I need to make it only active for my Projects menu item when viewing the projects archive.

Any ideas on how to do this?

I think I might of found the solution here… https://github.com/roots/roots-snippets/blob/master/nav-menu-active-fix-custom-post-types.php

This isn’t actually a Roots issue but a WordPress one. There’s also a new lib/nav.php that @Foxaii made that fixes this problem. It will end up in Roots master soon:

https://github.com/roots/roots/tree/nav_rejig