Following situation:

I have a drop down menu. At the moment we are located on a single post of the category "Produkt Design"

enter image description here

Its class in the menu is menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-145 The parent to whom I want to apply a special styling, since it is the parent of the active menu entry, has the following classes

menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-151

How can I make to get a special class to show in parent?

See demo of the menu here

enter image description here

  • I did it using javascript now in the demo page. But a clean php solution would be better – Toskan Apr 29 '14 at 11:05

You can add css classes to a menu item in the word press menu graphic interface. Either add the class to the parent or to the menu item then use css parent.

| improve this answer | |
  • well that is the thing, you cannot style something like this .menu-parent (ifchildhasclass(current-post-ancestor)){color: red;} – Toskan Apr 29 '14 at 12:31

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.