Main menu highlighting on subpage which is not in submenu but in hierarchy

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

Read More
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?

Related posts

Leave a Reply

1 comment