WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] Keep parent pages & categories highlighted in child pages? (10 posts)

  1. dan apparatus
    Member
    Posted 1 year ago #

    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/

  2. Roy Ho
    Member
    Posted 1 year ago #

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

  3. dan apparatus
    Member
    Posted 1 year ago #

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

    -Dan

  4. Roy Ho
    Member
    Posted 1 year ago #

    .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...

  5. dan apparatus
    Member
    Posted 1 year ago #

    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

  6. dan apparatus
    Member
    Posted 1 year ago #

    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

  7. dan apparatus
    Member
    Posted 1 year ago #

    .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

  8. Roy Ho
    Member
    Posted 1 year ago #

    .menu li.current_page_parent { // style }

  9. dan apparatus
    Member
    Posted 1 year ago #

    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

  10. jayaprakash.jp
    Member
    Posted 11 months ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic