Remove Siderbar From One Page Only

Hi Guys,

Am working on a website and am trying to remove the sidebar on one page only, am using Genesis and Woocommerce plugin.

I have tried to comment out but no luck, I have tried doing a template still no luck. Here is the code I used to remove the sidebar on single product pages:

// NEW WIDGET AREA FOR SINGLE PRODUCT VIEW
    if ( function_exists('register_sidebar') )
     register_sidebar(array('name'=>'Single Product Sidebar',
      'before_widget' => '<div class="widget-wrap">',
      'after_widget' => '</div>',
      'id' => 'product_sidebar',
      'description' => 'Widgets in this area will be shown on the single product view page only.',
      'before_title' => '<h4 class="widgettitle">',
      'after_title' => '</h4>',
    ));

    // content-single-product.php HOOK to get into the page to add single product sidebar.
    add_action('woocommerce_after_single_product', 'single_product_sidebar_hook');
    function single_product_sidebar_hook() { ?>
      <?php remove_action('genesis_sidebar', 'genesis_do_sidebar'); ?>
      <?php add_action('genesis_sidebar', 'genesis_single_product_sidebar');
                function genesis_single_product_sidebar() { ?>
                    <?php // SINGLE PRODUCT VIEW SIDEBAR
                        if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Product_Sidebar') ) : ?>
                    <?php endif; ?>
       <?php } ?>
    <?php }

Here is the website:

http://womanshealthychef.com/catalogue

Thanks

wrap the code you want to exclude in an if, and check to see if FILE matches your desired pagename?

Hi StarLion,

Thanks for the response. I did that before and it didn’t work. I used the above code.

The above code contains no such IF. Show me what IF you tried to use?

Thanks StarLion, I managed to fix the problem!

Thanks StarLion, I managed to fix the problem!

It would be helpful if you posted your fix as it might be helpful to others.

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.

This was my solution after searching online.