Make “Blog” and other post type archive menu links active when viewing single posts
Even when viewing single blog posts it is still nice to have the “Blog” nav menu link show the active status to give a feel for site hierarchy.
With this snippet you can match the nav link text with a conditional tag to add the <code>current-menu-item</code> class to a specific text string.
This code example targets a nav menu link labeled “Blog” and also highlights it when you are viewing category pages and single blog posts. You can also add more conditionals to target other text links like I have with the Stream.
Loading new replies...