Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #496125

    Hi!

    On my shop page I can add a custom sidebar widget, but how can I have a custom sidebar on product category pages?

    Thanks,
    desire

    #496431

    Hey Desire!

    Add this to your functions.php file.

    add_filter( 'avf_custom_sidebar', 'enfold_customization_custom_sidebar', 10, 1 );
    function enfold_customization_custom_sidebar( $custom_sidebar ) {
         if ( is_product_category( 'shirts' ) ) { $custom_sidebar = 'custom'; }
         return $custom_sidebar;
    }

    And change “shirts” with the slug of your product category.

    Regards,
    Elliott

    #743004

    Maybe this is related, but I have a added a “custom menu” widget to my Single Product Pages. Is it also possible to add this same “custom menu” as a sidebar to my product category pages?

    • This reply was modified 7 years, 9 months ago by craigriches.
    #745338

    Hey!

    Please add the custom menu widget in the “Displayed Everywhere” widget area then install the following plugin.

    // https://wordpress.org/plugins/widget-logic/

    Use the following conditional function:

    is_product_category()
    

    // https://docs.woocommerce.com/document/conditional-tags/

    Regards,
    Ismael

    #745439

    Sadly it didnt work for me. Maybe because we have a customised categories list on the category pages, it cannot be over-ridden.

    #745704

    Hi!

    Could you please provide a link to the category pages? And provide the login details as well so that we can test it.

    Cheers!
    Ismael

    #745747

    Hello Ismael,

    I was testing your instruction on my local install version of the website, so I can’t give you the links/login for that. But i do have a copy of the site on a live server which I would need to install the widget-logic plugin first before you can login and have a look.
    Just to confirm with you, am all I supposed to do is add the custom menu widget to the “displayed Everywhere” area, install widget-logic, and then add is_product_category( ) to the conditional field? This is all I have done on my local install, which appeared to have no effect. I haven’t added anything to the functions.php file, like you instructed the user Desire in an earlier part to this thread.

    I can give you a link to an example of a current category page on the live site to illustrate what is currently there, although it has been custom styled by a developer (no longer in our employ)
    I can also give you a link to a single product page example showing our custom menu in the sidebar which we would want to ultimately have appear on the category pages instead of what is there now, and hopefully get styled by someone in a similar way at a later point.

    #746103

    Hey!

    The markup of the category page looks different. Did you modify the archive-product.php template? Please compare it to the markup of the product category page in the demo.

    // http://kriesi.at/themes/enfold/product-category/tshirts/

    Best regards,
    Ismael

    #746421

    Ismael, the archive-product.php was indeed modified by a developer in the early stages of development. I had a look at the one in our child theme compared to the standard Woocommerce template and they do differ. I tested your suggestion using the plugin on my local install with the modifed code stripped out of the child theme archive-product.php and replaced with the standard version and it does work.
    So thanks for the advice.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘How: Sidebar on product category pages with woocommerce’ is closed to new replies.