Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using the new custom menus in my side navigation and it only creates a class sub-menu in the UL's but does not use the current_page_item like when you use wp_list_pages(). I have 3 levels and only want to show the sub menus of the page you are on, easily done using wp_list_pages() but I can't do it with the custom menus?

Can someone please help?

Thanks

share|improve this question

1 Answer 1

The current-item CSS class generated by wp_nav_menu() is .current-menu-item. However, wp_nav_menu() also has backward-compatibility with wp_page_menu()/wp_list_pages(), and does output .current_page_item (if the current context is a page post-type, of course).

So, a couple of possibilities:

  1. The current context is not a static Page
  2. You're using a custom walker for the wp_nav_menu() output, that doesn't output a CSS class for .current*.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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