0

So I have two parent elements with sub navs on my site, they're all just normal page menu links. I'm wondering whether I could have a specific sub nav stay visible when on any Woocommerce product page

Image of nav

0

Yes you can with conditional tags. https://docs.woocommerce.com/document/conditional-tags/

So depending on whether you wanted it to appear on all woocommerce pages (the listing page as well as the individual product pages) you could use is_woocommerce()

if you wanted just on individual product pages you could use is_product()

So you would use an if statement to check if this was true before outputting the call to the menu. You could put this in the header.php or template where you output your menu

if(is_woocommerce()){
  $args = array(        
    'menu' => 'Your submenu'
  );
  wp_nav_menu( $args );
}

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.