There is the situation. I have created the custom post type - products withfuncionality like pages - I have to create hierarchy.


  1. Chairs:
    • Oak Chair
    • Nice Chair

The weird thing happens with wp_nav_menu(). When I open the first level page Chairs and display all the Chairs childrens in theme, the nav menu for the li item Products, gets the .current-menu-item class, but when I open the child page f.e. Oak Chair, the class disapears.

Why is that and how to set .current-menu-item class also when child page is opened?

This same problem happens again :( WP Version 3.2.1

the ancestor-class .current-products-ancestor is not setted up :(

  • do you mean, that there is no .current-menu-item class on the child page? – Michael Aug 10 '11 at 11:10
  • Exactly. Only on parent page. – jam Aug 10 '11 at 11:21
  • Actully, wordpress gives tag .current-produkts-ancestor to menu element when child page is opened. This solves my problem, actually. I can then add different color to this menu item. – jam Aug 10 '11 at 12:24
  • 1
    This trick saves the world wordpress.stackexchange.com/questions/3014/… – jam Sep 28 '11 at 20:23

Use this selector:


... to change the styles on that menu.

  • Yes, that is what i figured out. – jam Aug 11 '11 at 7:27

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.