Community Forums › Forums › Archived Forums › Design Tips and Tricks › Show WooCommerce Product Categories only in Sidebar on WooCommerce Pages
- This topic has 11 replies, 2 voices, and was last updated 8 years, 2 months ago by plentyvegan.
-
AuthorPosts
-
June 16, 2016 at 3:01 pm #187711plentyveganMember
Hi and thanks in advance for any help you can offer.
I have installed WooCommerce and Genesis Connect for WooCommerce on my Genesis, Divine Theme site. I find the sidebar that works for the rest of the site - the blog, mostly - is goofy when it comes to the store: http://plentyvegan.com/shop/. I haven't populated the products yet, but I want the shop to serve as a stand-alone market. I think the best way to do this would be to have the sidebar only consist of product category selections, like in most ecommerce stores, on all WooCommerce pages - shop, product pages, category pages, etc. - and have the sidebar that shows recent posts, Instagram feed, etc. appear on the rest of the site.
If possible, I would like this category tree to be a left-hand sidebar, vs. my right-hand sidebar for the rest of the site (odd, maybe, but seems to be convention?).
Is there any way to customize this?
Thanks again.
http://plentyvegan.com/shop/June 16, 2016 at 3:53 pm #187713Brad DaltonParticipantYou can install a plugin like Widget Logic and use the is_product() conditional tag
Or
You can use Genesis Simple Sidebars and add support for WooCommerce
Or
You can hand code a sidebar widget area in a single product template.
June 16, 2016 at 4:04 pm #187714plentyveganMemberThanks for responding so quickly!
I actually just installed Genesis Simple Sidebars. It's great.
Now, I want to make sure only that sidebar appears on my WooCommerce pages. To that end, I dropped this code in the functions.php file:
function themeprefix_remove_default_sidebar() {
if( is_page ( array( 'cart', 'checkout' )) || 'product' == get_post_type() ) {//set which pages
remove_action( 'genesis_sidebar', 'ss_do_sidebar' );
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
add_action( 'genesis_sidebar', 'themeprefix_add_woo_sidebar' );
}
}
//Alternative Sidebar
function themeprefix_add_woo_sidebar() {
dynamic_sidebar( 'Plenty Vegan Market' ); //add in the sidebar name
}
add_action( 'genesis_before_sidebar_widget_area', 'themeprefix_remove_default_sidebar' ); //sets the ball rollingNow what is happening is the the sidebars are stacked, rather than the Primary Sidebar that I have active on the entire site being removed. Here's an example: http://plentyvegan.com/product/herb-crackers/
I grabbed that code from someone's site so I can't figure out what to edit to remove the Primary Sidebar. Do you know what I edit?
Thanks again.
June 16, 2016 at 4:49 pm #187716Brad DaltonParticipantI suggest you ask the original author of the code why it doesn't work and how to fix it.
Also, i can't see it stacked, did you link to the site where the code is installed?
June 16, 2016 at 4:52 pm #187717plentyveganMemberI've asked the author - thought I'd try you too just in case there's no response there.
Yeah that page show them stacked (http://plentyvegan.com/product/herb-crackers/). The Simple Sidebar begins at "Product Categories". If you click to the blog, you'll see that the sidebar there doesn't have that part.
June 16, 2016 at 4:56 pm #187718Brad DaltonParticipantI wouldn't use simple sidebars and code at the same time.
I would choose which solution you want to use and only use 1 solution to avoid conflicts.
June 16, 2016 at 5:03 pm #187719plentyveganMemberAh ok.
Sounds like your suggestion of:
- You can install a plugin like Widget Logic and use the is_product() conditional tag
Is simple enough. I'll try that route.
Thanks for your help - I'll give it a go tomorrow and if I have issues, might hit you up for more suggestions. Great help!
June 17, 2016 at 12:25 am #187725Brad DaltonParticipantAlso note: The WooCommerce Genesis Connect plugin includes support for Genesis Simple Sidebars built in.
June 17, 2016 at 9:48 am #187748plentyveganMemberI'm a bit lost on this point. I have WooCommerce Genesis Connect installed and Genesis Simple Sidebars. What does it mean that Connect includes support for Sidebars?
June 17, 2016 at 12:16 pm #187760plentyveganMemberUpdate:
I uninstalled simple sidebars and installed WooSidebars. Seems to work like a charm.
Thanks!
June 17, 2016 at 8:48 pm #187774Brad DaltonParticipantGood solution if you want to use another plugin.
If you want a custom template which includes a custom sidebar for single product pages, here's a template i spent several hours coding for use in any Genesis child theme.
June 27, 2016 at 10:23 am #188386plentyveganMemberThanks for your help. I think I have a workable solution for now. Great to have the code for the custom sidebar if that looks like a good option for the future.
Thanks again.
-
AuthorPosts
- The topic ‘Show WooCommerce Product Categories only in Sidebar on WooCommerce Pages’ is closed to new replies.