Archived topic
Keep the home menu-item selected when a blog post is opened
3 replies · Started by Florian on April 13, 2019
Hey,
I want menu items to be active when a child-page of them is selected. So when a menu item leads to http://www.homepage.com/page5, I also want the menu item to be highlighted when I go to http://www.homepage.com/page5/subpage6
For pages, I achieve this by applying the selected menu item style to the ".current-page-ancestor" class and this works well. But this class is not there when I view a blog post, since blog posts are child pages of the base-URL directly.
Is there a way to highlight the "home" menu item when a blog post is opened?
Hi there,
so the Blog menu item will remain underlined when you're on a post?
You could try using a selector to target the first menu item on the single post e.g
.single-post .main-navigation .main-nav ul li:first-child > a
Thank you, that seems to work!
Glad to be of help