I'm using the default Twenty-Twelve (1.1) Wordpress (3.5.1) theme with Woocommerce (1.6.6), and would like to use a different sidebar for the shop pages - cart, checkout, my account etc. as opposed to displaying the theme's default sidebar on each of these pages.
Looking over the documentation for the Woocommerce plugin, it says that one of the ways to override the plugin's layouts and settings is by creating a folder in my themes directory called
/woocommerce, placing the necessary files or folders into this and then customizing it to suit.
I've now done this, gone into my theme's
/woocommerce/archive-product.php folder and placed this at the bottom of the file:
<?php /** * woocommerce_sidebar hook * * @hooked woocommerce_get_sidebar - 10 */ /* do_action('woocommerce_sidebar'); */ ?> <?php get_sidebar( 'shop' ); ?> <?php get_footer('shop'); ?>
Then to create an additional sidebar in my Widgets panel, I've placed this into my
register_sidebar( array( 'name' => __( 'Woocommerce Sidebar', 'mythemename' ), 'id' => 'shop-widgets', 'description' => __( 'Appears on the shop page of your website.', 'mythemename' ), 'before_widget' => '<div id="%1$s" class="widget %2$s shop-widgets">', 'after_widget' => '</div>', 'before_title' => '<h1 class="widget-title">', 'after_title' => '</h1>', ) );
Now finally, I've created a
sidebar-shop.php file in my themes directory:
if ( ! is_active_sidebar( 'shop-widgets' ) ) return; // If we get this far, we have widgets. Let do this. ?> <div id="secondary" class="widget-area" role="complementary"> <?php if ( is_active_sidebar( 'shop-widgets' ) ) : ?> <div class="first front-widgets"> <?php dynamic_sidebar( 'shop-widgets' ); ?> </div><!-- .first --> <?php endif; ?> </div><!-- #secondary -->
This works great, but only displays the new sidebar on my Shop page and not the other pages - cart, checkout, my account etc. They display the default sidebar.
From what I can tell, this is because the
archive-product.php only affects the Shop page and not the others?
So I was wondering where do I locate or make the necessary changes to call the new sidebar on these other pages instead showing the default sidebar, just as I have done with my Shop page?