WordPress.org

Ready to get started?Download WordPress

Forums

Ancestor problem with menu item that appears twice (1 post)

  1. thommo
    Member
    Posted 2 years ago #

    I have a page that appears twice in the menu hierarchy (to allow users to find the content from different directions). I am using the class current-menu-ancestor to show the user what section of the site they are in. When that are on my "duplicated" page, both top level menu items are highlighted.

    While this might be right in some circumstances, it doesn't work for this site! I want to only have one of these highlighted, the one that is the "prime" ancestor, identifiable from the post parent hierarchy.

    I have put a very nasty piece of jQuery in place to remove the second current-menu-ancestor class from the unwanted top level menu item but this is about as nasty as it can possibly get and will break if the slightest change is made to the site so I know I need a "real" solution instead. However, I have been racking my brains about it and Googling like mad without coming up with a solution.

    Can anybody point me in the right direction?

    Thanks in advance!

Topic Closed

This topic has been closed to new replies.

About this Topic