• Mike_O

    (@mike_o)


    If that title makes sense, otherwise more detail…

    I have Navigation Menu built to show both posts (though custom post types) and pages – Page / Category_A / Category_B / Page / Page. The issue I have is with the highlighting of the parent menu items when a post is assigned to both Categories…

    Clicking on ‘Category_A’ lists all the posts in that category, and highlights the parent link. Clicking on posts Y & Z under that category, keeps the parent link highlighted. In Category_B I have posts V & W. no problems there, however I have one post (let’s say X) (and I’m sure the client will add more) that is in ‘Category_A’ and ‘Category_B’, which when clicked, of course highlights both Parent menu items (technically as it should as it’s in both categories).

    It it possible to highlight only the direct parent link based on whatever category is clicked??

    i.e. if you click ‘Category_A’, then ‘Post-X’ Category_A is highlighted, however if you click Category_B, then Post-X, Category_B is highlighted.

    In my search I found one answer that ‘hides’ the second link using CSS (.current-menu-item:nth-of-type(1) ), but if a user clicks on ‘Category_B’, then ‘Post-X’, then you can’t have ‘Category_A’ highlighted…

    Any way of solving it appreciated,

    Many thanks,

    Mike

  • The topic ‘Highlight single parent category with multiple child categories’ is closed to new replies.