S
S
Sergey2015-03-26 10:32:20
CMS
Sergey, 2015-03-26 10:32:20

How to highlight menu item in wordpress?

Hello. There is a business card site on WordPress, on which I display the menu in this way:

wp_nav_menu(array('theme_location' => 'header-menu', 'menu_class' => 'main-menu', 'container' => 0));

Everything seems to be fine, I replaced the current-menu-item class in css and set it up for myself - everything seems to work, but there is a problem: when I am on the main page, which is registered in the menu, the current-menu-item class is added to the li element, but when I go to the page of the full description of the post, the class, of course, is not added. It’s easy to find out that we are in this category and I already have a boolean variable prepared for this matter, but I just don’t know how and where to apply it so that everything works as I need. I ask for help or at least directions where to dig. Thank you for your attention

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Perin, 2015-03-26
@seoperin

In the same place, there seems to be a current-menu-ancestor class for the parent menu item, if a child is selected, style through it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question