I’m building a site that has a two level menu created with the admin Menu tool. The menu contains links to both Pages and Category lists. It doesn’t link directly to Posts. The problem is that when you drill down into a Category list and click to view a single post in that Category, the menu highlighting gets it wrong.
I’ve tested on a new install of WP3, set up a simple test site with a few pages and posts in 3 categories. All I’ve changed in the theme is the style.css to highlight the whole path.
Here’s a direct link to view a categorised post here:
http://danwashere.com/wp_dev/2011/07/28/blue-rocks/
Everything is a page, except with the section “Advice Categories” – all those sub items are category lists containing categorised posts – each post is only categorised with a single category. The menu structure is defined entirely in the Menu settings.
On that Blue Rocks page, the menu should be highlighted like this: Advice Categories -> Rocks, but it’s highlighting the Sample Page item. And if you rollover the “Advice Categories” menu, you’ll see that it is correctly highlighting the “Rocks” menu item.
It seems to me that WP is applying the ‘current-post-parent’ class to the wrong top menu item, but maybe I’m missing something?
// Edit, rewrite to make it clearer.
It seems as though were both having very similar issues. – Trouble highlighting correct menu parent with wp_nav_menu classes while viewing âsingle postsâ
Im not using categories as links in my menu but I use them to filter content to each page via
query_posts
…if you examine the output from WordPress you’ll notice its actually placing the current page class onto the incorrect li tag when viewing a single post – Is this happening to you as well?