Skip to content

Instantly share code, notes, and snippets.

@neilgee
Forked from blogjunkie/functions.php
Last active October 6, 2016 01:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save neilgee/ceafbd3ac9dbf2e10603 to your computer and use it in GitHub Desktop.
Save neilgee/ceafbd3ac9dbf2e10603 to your computer and use it in GitHub Desktop.
WooCommerce Genesis Connect + WooCommerce Sidebar
<?php //<~ don't add in
// Declare WooCommerce support for your theme
add_theme_support( 'woocommerce' );
<?php //<~ do add in
/**
* WooCommerce Template
*
* Template used for all WooCommerce views in order to avoid using Genesis Connect
* Save this into `themename/woocommerce.php`
*
*/
//* Add WooCommerce content output
if ( function_exists( 'woocommerce_content' ) ) {
// Remove standard post content output
remove_action( 'genesis_loop', 'genesis_do_loop');
// Replace the default Genesis loop with WooCommerce's
add_action( 'genesis_loop', 'woocommerce_content' );
}
genesis();
<?php //<~ don't add in
function themeprefix_remove_default_sidebar() {
if( is_page ( array( 'cart', 'checkout' )) || 'product' == get_post_type() ) {//set which pages
remove_action( 'genesis_sidebar', 'ss_do_sidebar' );
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
add_action( 'genesis_sidebar', 'themeprefix_add_woo_sidebar' );
}
}
//Alternative Sidebar
function themeprefix_add_woo_sidebar() {
dynamic_sidebar( 'woocommerce-sidebar' ); //add in the sidebar name
}
add_action( 'genesis_before_sidebar_widget_area', 'themeprefix_remove_default_sidebar' ); //sets the ball rolling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment