0

have a menu that is pulled in like this:

<?php wp_nav_menu ( array('menu' => 'header') ) ?>

I am using WooCommerce and when visiting /shop the shop link in the header has the class: current_page_item

However, when viewing a single product the menu link has no active class.

This is also the case when viewing categories etc.

The link in the URL /shop/category/phone/ shows it has a parent of the shop page but no active states.

Is it possible to set WordPress to do this?

0

The shop link in your menu gets the "current_page_parent" class when your on a product page. If you have any WooCommerce categories in your menu, they will get "current-product-parent" as a class when you're on e product page from that category.

Simply give those classes the same styling as your active class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.