The navigation menu of my site is generated via
wp_nav_menu( array( 'theme_location' => 'primary') );
Some menu entries are category pages (say /category/news/
). This page contains links to the next level, single post posts (say /news/123/
).
I noticed that the menu is only highlighted (‘current-menu-item’ class) when the category page is the current. How can I make the menu stay highlighted when viewing single post pages (/news/123/
)?
You can target the
.current-menu-parent
class in your CSS to keep the category highlighted when viewing single posts.