[wp-hackers] wp_nav_menu CSS classes not working on CPT archive pages
wp-mailing at fklein.info
Wed Dec 19 21:01:24 UTC 2012
I'm working on a website with a custom post type for press releases, that has a an archive template (archive-press-releases.php) which lists all the press releases. This archive has been added to my custom menu as a simple link pointing to http://www.mysite.com/press-releases/. It is placed in the second level, under a parent page called "Press" with two other sibling elements.
I have implemented a wp_nav_menu with a custom walker that uses the current, ancestor and parent CSS classes to figure out which pages are under the parent page "Press" in the menu structure in order to generate a secondary menu.
This works perfectly on the first page of the press releases listing, but once I browse the archives, for example http://www.mysite.com/press-releases/2011/ or the second page (http://www.mysite.com/press-releases/page/2/), the wp_nav_menu doesn't output the current, ancestor and parent CSS classes anymore, so my custom walker stops working and the secondary menu disappears. The menu and the walker work correctly on the two sibling menu elements, which are simple pages.
Does anybody have experience with this or a similar case?
Thanks in advance for your responses, regards,
More information about the wp-hackers