-
AuthorPosts
-
August 31, 2015 at 9:56 pm #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,
desireSeptember 1, 2015 at 3:16 pm #496431Hey 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,
ElliottFebruary 5, 2017 at 2:53 pm #743004Maybe 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, 10 months ago by craigriches.
February 10, 2017 at 11:50 am #745338Hey!
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,
IsmaelFebruary 10, 2017 at 3:13 pm #745439Sadly it didnt work for me. Maybe because we have a customised categories list on the category pages, it cannot be over-ridden.
February 11, 2017 at 7:25 am #745704Hi!
Could you please provide a link to the category pages? And provide the login details as well so that we can test it.
Cheers!
IsmaelFebruary 11, 2017 at 11:57 am #745747Hello 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.February 13, 2017 at 5:21 am #746103Hey!
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,
IsmaelFebruary 13, 2017 at 2:56 pm #746421Ismael, 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. -
AuthorPosts
- The topic ‘How: Sidebar on product category pages with woocommerce’ is closed to new replies.