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 have my menu made of images. Therefore I use divs and with .current-menu-item I use CSS to change the image. This works if I'm directly on this main page. If I'm on a subpage I cannot use this trick anymore. The reason is that the submenu is build like the following:

Each page has set a parent. The submenu is generated with

wp_page_menu(array(
    'child_of' => SUBMENU_ROOT
));

whereas SUBMENU_ROOT is the fetched top most parent. So I have the parent ID which should be highlighted in the main menu. How can I achieve a highlighting of the main menu when I'm on a subpage?

Or is the only way to use the normal menu dialog?

share|improve this question

1 Answer 1

You could use .current-menu-parent and/or .current-menu-ancestor.

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.