I have the following css:

nav ul ul {
  display: none;

It hides sub-menus for me. It works too well. I'd like the sub-menu to be visible iff the parent menu item is the parent of the selected item. Is there an easy way to do this?


Try using the following code.

.current-menu-ancestor > ul {

The class current-menu-ancestor appears if the current item is a parent of a current page item.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.