0
votes

I am working with the Roots WP theme. In any case I have installed Woo Commerce as well and I am trying to get it configured to NOT show any sidebar on all Woo Commerce pages.

I have gone through this entire tutorial twice: http://roots.io/using-woocommerce-with-roots/

It does not address how to remove the sidebar for Roots/WooCommerce, just how to remove the duplicate headers, footers and sidebars. Check! I have that accomplished; now I just want to remove the sidebar all together.

I have added the archive-product.php, single-product.php pages into the Roots theme and inserted this line of code:

 <?php woocommerce_content(); ?>

I have edited the lib/config.php file to not show a side bar on certain themes.

 array(
        'template-custom.php',
        'template-page.php',
        'template-shop.php',
        'archive-product.php',
        'single-product.php'
    )

No avail!

I have done everything that I can possibly think of to remove the side bar. Anyone have any suggestions?

Thanks!

1

1 Answers

1
votes

You can add any of the WooCommerce conditionals to the first array in the sidebar config of /lib/config.php.

I would start by adding is_woocommerce to remove the sidebar from all WooCommerce pages.

Example:

function roots_display_sidebar() {
  $sidebar_config = new Roots_Sidebar(
    /**
     * Conditional tag checks (http://codex.wordpress.org/Conditional_Tags)
     * Any of these conditional tags that return true won't show the sidebar
     *
     * To use a function that accepts arguments, use the following format:
     *
     * array('function_name', array('arg1', 'arg2'))
     *
     * The second element must be an array even if there's only 1 argument.
     */
    array(
      'is_404',
      'is_front_page',
      'is_woocommerce' // New Conditional for WooCommerce Pages
    ),
    /**
     * Page template checks (via is_page_template())
     * Any of these page templates that return true won't show the sidebar
     */
    array(
      'template-custom.php'
    )
  );