[Resolved] Keep the home menu-item selected when a blog post is opened

Home Forums Support [Resolved] Keep the home menu-item selected when a blog post is opened

Home Forums Support Keep the home menu-item selected when a blog post is opened

  • This topic has 3 replies, 2 voices, and was last updated 5 years ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #867700
    Florian

    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?

    #867835
    David
    Staff
    Customer Support

    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

    #867854
    Florian

    Thank you, that seems to work!

    #867858
    David
    Staff
    Customer Support

    Glad to be of help

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.