How to remove the sidebar from some Woocommerce archive pages

Posted in: Newspaper
Post count: 200

Hi guys! Need some support!

I’m using version 9.5 of the Newspaper theme and I see that there’s an option to show or hide the sidebar on Woocommerce pages in the admin panel:

Template settings > WooCommerce template > Shop homepage + Archives

However I need to remove (not hide) the sidebar only from specific top-level archive pages via some code in functions.php or so… The sidebar has to stay on the child-level archives. How can I do this?

Thanks!

Post count: 18283

Hello !

This should work using CSS: .page-id .woocommerce-page #content .single_wrap {
float: none;
width: 100%;
}
.page-id .woocommerce-page #sidebar {
display: none;
}

The code must be inserted here: https://www.screencast.com/t/J1Nxw5s5

Please try this css code and let us know the result !

  • This reply was modified 5 years by Vlad S.
Post count: 200

Hi Vlad!
In your code where are you defining the specific archives?

Post count: 18283

Hello !

That is found in the page you want. Please provide a link to one of your archives and I will show you an example.

Thank you !

Post count: 200

I added the code you provided in the respective field, but nothing changes.

Here’s a top-level archive page where I’d like to remove the sidebar and stretch the other content to fill the empty space. The content has been created using a table in the admin. I can make 3 instead of 2 cells with thumbnails per row and it will fit perfectly on the place of the sidebar: bit.ly/3d0d8T2

At the same time, here’s a child of that top-level category that needs to keep it’s sidebar: bit.ly/2MIBdDb

Thank you for your help!

Post count: 18283

Hello !

I have edited the code a bit: .term-190 .td-container .td-pb-span8 {
width: 100%;
}
.term-190 .td-container .td-pb-span4 {
display: none;
}

You will need to inspect the page you want and add the term to your code: https://www.screencast.com/t/LMXZnVIs

You will have to add this code to each TERM you want to edit.

I hope this was helpful !

Thank you !

Post count: 200

That works! If I wish to use it on 2 different top-level categories, how should I edit it? Is it like this:

.term-190 .td-container .td-pb-span8 {
width: 100%;
}
.term-190 .td-container .td-pb-span4 {
display: none;
}
.term-200 .td-container .td-pb-span8 {
width: 100%;
}
.term-200 .td-container .td-pb-span4 {
display: none;
}

I can see this code works, but is this the right way?

One last thing – is it possible to remove the product loop from these same pages?
If possible, not to hide the products, but remove them so that the top-level category doesn’t link to the separate products and their thumbnails don’t load on page load. This is needed for SEO purposes.

Thanks!

p.s. Please remove your screenshot. Thanks.

Post count: 18283

Hello !

I can see this code works, but is this the right way? Yes, that is how you will have to do it.

Unfortunately for that you will need custom coding. A css code will only hide it but that would not be helpful for SEO.

Thank you !

Post count: 200

I understand. Until I find a custom solution, what CSS can I use to hide the loop?

Post count: 18283

Hello !

We can try to see what can be done. Can you let us know exactly what loop you are looking to remove ?

Thank you !

Viewing 10 posts - 1 through 10 (of 10 total)
The forum ‘Newspaper’ is closed to new topics and replies.