[wp-hackers] WordPress 3 - Problem with menu highlighting

Dan Searle dan at danwashere.com
Wed Aug 10 16:29:12 UTC 2011

Hi all, this is my first mail here so let me know if I'm doing anything 
wrong? I couldn't find a posting guide for this list, so I'll just go 
for it.

I've already asked this on Stackoverflow but I'm getting no help there:

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:

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?

Many thanks,

More information about the wp-hackers mailing list