I have a blog on a website with a sidebar on the right and on the rest of the website, the sidebar should not appear. On the web I also have the woocommerce for purchases. The weird thing is that on the individual product pages, the sidebar appears just below the product images BUT to the left.
This bar should not appear anywhere other than the blog. I have looked a thousand times in the settings and there is nothing that indicates a sidebar on the left (only on the right and in the blog).
So after all this, I decided to go into the woocommerce .php files hoping to remove it from there... and I should have removed it, but the bar is still there.
I went to single-product.php and removed this code
<?php
/**
* woocommerce_sidebar hook
*
* @hooked woocommerce_get_sidebar - 10
*/
do_action('woocommerce_sidebar');
?>
After removing it, I went to archive-product.php and removed the following:
<?php
/**
* woocommerce_sidebar hook
*
* @hooked woocommerce_get_sidebar - 10
*/
do_action('woocommerce_sidebar');
?>
Finally, I went to the usual css of my wordpress and added the following rule:
#content-woocomerece{
width:100% !important;
}
I added the !important later when I saw that it had no effect, but not even with those did the bar disappear. I also tried the following (replacing the above css rule with this one) but it didn't work either:
.woocommerce #sidebar{display:none;}
I also tried to put the following in the functions.php without success:
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10);
With the CSS I made the sidebar invisible with visibility:hidden only in the store bar (in the blog the corresponding sidebar continued) but the problem is that it occupies a lot of that sidebar and leaves a huge blank space (which is why that I want to remove it, since it makes the store ugly and on top of not having anything useful for the store, it takes up a lot of space and the rest is left blank).
aside.sidebar.sidebar_sidebar_right.alpha.units{
visibility:hidden;
}
I don't know what else to try (the only line I saw in sidebar.php related to woocommerce didn't help removing it, so I put it back).
I will be very grateful if someone can help me. I leave an image of what it looks like and the bar that needs to be removed:
Ok, I already found how to do it... in the end it wasn't any code, but an option that was in the widget area and that yesterday after searching and searching, I shouldn't have seen.
In Widgets, in display everywhere, you have to delete everything that appears there if you don't want it to be seen on all sites (including those where the theme options don't include) and put the widgets on the left side selecting where you want them to be see and done.