2

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

f.e:

  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 :(

4
  • do you mean, that there is no .current-menu-item class on the child page?
    – Michael
    Aug 10, 2011 at 11:10
  • Exactly. Only on parent page.
    – jam
    Aug 10, 2011 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, 2011 at 12:24
  • 1
    This trick saves the world wordpress.stackexchange.com/questions/3014/…
    – jam
    Sep 28, 2011 at 20:23

1 Answer 1

0

Use this selector:

.current-products-ancestor

... to change the styles on that menu.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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