WordPress.org

Support

Support » Plugins and Hacks » WooCommerce » Trying to remove sidebar from all Woo commerce Pages

Trying to remove sidebar from all Woo commerce Pages

  • I created a woocommerce.php file and replaced my theme’s loop with//
    <?php woocommerce_content(); ?>
    It worked perfectly! My sidebar was then placed in the correct position.

    My issue is what it seems to be an invisible sidebar…
    I would like my WooCommerce pages to be full width.
    But each page template seems to have a huge gap on the right hand side (where my sidebar once was)

    I basically would really LOVE to find out what I can do in order to make all Woo Pages full width.

    I will paste whatever code needed in a pastebin, just not sure which, so please let me know!

    http://wordpress.org/extend/plugins/woocommerce/

Viewing 15 replies - 1 through 15 (of 44 total)
  • try writing this code in the css theme editor
    .woocommerce #sidebar{display:none}

    Roy Ho

    @splashingpixelscom

    It is not good idea to use CSS to hide things with display:none when there are better solution.

    You can try the function is_woocommerce() which will check if the current page is a woocommerce template…With that, you can wrap it around the code that displays the sidebar and negate the check so it won’t display the sidebar on those pages.

    if ( ! is_woocommerce() ) { get_sidebar(); }

    @splashingpixels.com I’ve deleted the sidebar div completely here is my woocommerce.php HTML//@splashingpixels.com I’ve deleted the sidebar div completely here is my woocommerce.php HTML//

    <?php get_header(); ?>
    	<div id="container" class="clearfix">
    		<div id="content-wrap">
    			<?php woocommerce_content(); ?>
    		</div>
    	</div>
    <?php get_footer(); ?>

    Should I still use the snippet you suggested in my woo file?

    Roy Ho

    @splashingpixelscom

    No, if you could do it in the WooCommerce template, that is fine. My snippet is only for themes that have a custom template that displays the WooCommerce products page along with regular pages.

    But one suggestion for you is instead of deleting it since you “may” want it back at one day…Just comment it out…Wrap the section iwth /* and */ so it will be ignored.

    I just fixed this on our website. You can take the sidebar out simply by commenting out the information in the woocommerce/templates/shop/sidebar.php file like splashing suggested. Simply put a /* and */ around everything there and it will take it out. If you need more help, drop me a line at http://www.cohesivewebdesigns.com and I’ll be glad to help. But that should fix it.

    cohesiveideas – thanks for the post. This really cleaned up my shop.

    You are very welcome! To say thanks, you should add our website link to your resources page 😉

    Crikey I’ve tried everything I can find on this but still can’t get rid of the sidebar.

    1. Tried adding the following to the themes functions.php file

    remove_action( ‘woo_main_after’, ‘woocommerce_get_sidebar’, 10);

    2. Tried commenting out do_action(‘woocommerce_sidebar’); in archive-product.php

    3. I’ve copied the Template folder over to my theme Woocommerce folder, and in \templates\shop\sidebar.php and commented the content out.

    4. I even deleted the sidebar.php file completely

    but no change at all in my shop.

    Really don’t get this please please help, the shop just looks a mess with the sidebar.

    Make sure that your theme is not showing a sidebar on that page for some reason. The commenting out on the WooCommerce worked 100% for me even after the 2.0 updates. Go back and make sure that everything is 100% as stated above and not one single character is misplaced.

    My 1 to 4 has all been done as stated. remove_action( ‘woo_main_after’, ‘woocommerce_get_sidebar’, 10); for instance is copied and pasted directly from the page in question.

    The ‘Shop’ page which is automatically generated and doesn’t have the short codes on its edit page that say ‘checkout’ page does with [woocommerce_checkout]

    All the other pages

    Cart
    Checkout
    Checkout → Pay
    Order Received
    My Account
    Change Password
    Edit My Address
    Lost Password
    View Order
    Track your order

    Have a shortcode, and allows me to use the theme options and choose to have ‘full width’ but the ‘shop’ page doesn’t allow any control like this.

    I have read that the ‘shop’ page (which also serves as the template for the category’s pages, and single product pages) is an archive not a page?

    One thing I would say Cohesive is that on the sidebar.php which looks like

    ?*<?php
    /**
    * Sidebar
    *
    * @author WooThemes
    * @package WooCommerce/Templates
    * @version 1.6.4

    if ( ! defined( ‘ABSPATH’ ) ) exit; // Exit if accessed directly

    get_sidebar(‘shop’); */ ?>

    The <?php … ?> can’t be commented out, I can’t see why that would matter though?

    Oh something I should point out is that the theme is Woo ready, and has its own Woocommerce folder already.

    Really stuck on this one.

    I don’t think our theme is WooCommerce ready but another client of our has a WooCOmmerce ready theme. You might want to dig through the theme folder and see if there is a ProductPage.php file or something that is controlling the footer. Sometimes WooCommerce ready themes do that. So even if you made the change in WooCOmmerce, the theme would override it.

    We aim to produce the most cohesive websites that we can when we build them.

    This is what I used/ added to my functions.php file to remove the sidebar on all pages

    /**
     * WooCommerce
     *
     * Unhook sidebar
     */
    remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10);

    HTH

    Thanks Mariaarti, your idea worked perfectly for me!
    .woocommerce #sidebar{display:none}

    Here is how to remove the sidebar.

    go to wp-content/plugins/woocommerce

    in file single-product.php remove the following code

    <?php
    		/**
    		 * woocommerce_sidebar hook
    		 *
    		 * @hooked woocommerce_get_sidebar - 10
    		 */
    		do_action('woocommerce_sidebar');
    	?>

    next edit the file archive-product.php and remove the following code

    <?php
    		/**
    		 * woocommerce_sidebar hook
    		 *
    		 * @hooked woocommerce_get_sidebar - 10
    		 */
    		do_action('woocommerce_sidebar');
    	?>

    next we have to edit the style.css in your theme folder
    find
    #content-woocomerece
    add the following before the } tag on the last line
    width:100%;

    NOTE: You can not add the /* */ to the line it will not comment it out.

    hi,

    i wonder this solution works, as i need my WooCommerce sidebars to be removed.

    it looks ugly.

    here is my WEBSITE.

    http://holidaycrafts.com.au/shop/

    Cheers,
    boie

Viewing 15 replies - 1 through 15 (of 44 total)
  • The topic ‘Trying to remove sidebar from all Woo commerce Pages’ is closed to new replies.
Skip to toolbar