Reply 181286 to: Shop Sidebar Position based on Category

Avatar: thisisbolo
thisisbolo
Participant
January 7, 2018 at 18:53

I think I figured this out. I’ve undercovered 2 different approaches. Adding in

Approach 1:

Edit the ‘archive-product.php’ in child theme

<?php
  
  if ( has_term ( 'Category-Term', 'product_cat') ) {
    // Edit the 'archive-product.php' to remove the sidebar
  } else {
    // Edit the 'archive-product.php' to remove the sidebar to do something else
  }

?>

Approach 2 (this requires a bit more CSS editing)

Edit style.css in child theme

.term-Category-Term .content-page {width: 1170px !important;}
.term-Category-Term .sidebar {display: none;}
.term-Category-Term .col-md-push-3 {left: unset}
.term-Category-Term .col-md-9 {width: 100%;}

It looks like for the CSS approach, it’d have to be for every term so if the category you’re selecting has sub-categories, then those category terms need to be selected for ‘Category-Term’

If you folks on the support forum have a better approach, I’m open 🙂

Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.