WordPress.org

Support

Support » Plugins and Hacks » WooCommerce » [Resolved] Keep parent pages & categories highlighted in child pages?

[Resolved] Keep parent pages & categories highlighted in child pages?

  • Hey, All. I have a hopefully easy request.

    I am working with Woocommerce on a Responsive child theme. In the store I’ve built some custom menus for categories and sub-products (STORE > Prints > “Print #1”, etc.) When someone is on one of my Woocommerce product pages I am trying to figure out how to keep the parent section links highlighted as well. None of the child and parent page css commands seem to work since these are not typical ‘pages.’ Here is a link to an example page: http://aestheticapparatus.com/product/prints/gccc1/
    As you can see from the address, the product is a sub-group of PRODUCT > PRINTS, so I would like PRODUCTS and PRINTS to stay highlighted on the page when I am on this specific product.

    Does that make sense?
    Any thought or advice?

    Thanks!
    -Dan

    http://wordpress.org/extend/plugins/woocommerce/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Roy Ho

    @splashingpixelscom

    You’re looking for this class -> current-menu-parent

    Hey, Splashingpixels. Thanks!
    I’ll give this a try and see what I get.

    -Dan

    Roy Ho

    @splashingpixelscom

    .sub-header-menu li.current-menu-parent { // your style here }

    or

    .sub-header-menu li.current-product-parent { // your style here }

    or

    .sub-header-menu li.current-product-ancestor { // your style here }

    or you can do all three just to cover all bases…

    Splashingpixels, that class works great to highlight the parent menu ‘PRINTS’ but fails to highlight the ‘grandparent’ menu STORE. I tried .current-menu-ancestor but that didn’t seem to function either.

    Any additional thought?
    I really appreciate your help.

    -Dan

    Oops, posted at the same time you posted your follow-up. Let me check these out and see what I can do.

    Thanks a lot!

    -Dan

    .sub-header-menu li.current-product-ancestor worked great for products under the sub-header-menu, but for some reason I’m not getting it to function when I attempt the same code with the main menu.

    I assumed that I could simply replace .sub-header-menu with .menu but that seems to do nothing.

    Any other thoughts?
    Thanks!
    -Dan

    Roy Ho

    @splashingpixelscom

    .menu li.current_page_parent { // style }

    WOO HOO! That did it!
    I did have to tweak it and add an ‘a’, but that’s the daddy. Thanks so much for your help. It seemed quite easy for you, but I still appreciate it.

    Marking this topic… resolved.

    -Dan

    Header menu should get highlighted when the page is opened. woocommerce

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] Keep parent pages & categories highlighted in child pages?’ is closed to new replies.
Skip to toolbar