WordPress.org

Forums

current-menu-ancestor class not showing up in nav menu of mixed type items (2 posts)

  1. skarck
    Member
    Posted 1 year ago #

    I'm using wp_nav_menu to show a multi-depth menu consisting of different types of items, p.e:

    • Page
      • Custom Taxonomy term archive
      • ...
    • ...
    • ...

    When I'm on 'Page' the first level item has the class current-menu-item as intended.
    When on the term archive 'Page' has the class current-menu-parent' and the archive menu itemcurrent-menu-item`.
    All good so far.

    When I now visit a post that has the archive's term assigned the sublevel term menu item has current-menu-parent but the 'Page' has no current-*class at all.

    Is this an intended behavior?
    Since it seems a bit illogical to me, is there any fix how to mark the all items of the menu branch with classes if any of its sub items has a current-* class?

    thx

  2. Sith Lord Goz
    Member
    Posted 7 months ago #

    +1

    Up until now, I've had to use javascript to add current-menu-ancestor classes back up to the root for any item that is a 'current' menu. Would be great if this was built into core.. or even an easy patch for a custom Nav Walker function

Topic Closed

This topic has been closed to new replies.

About this Topic