Skip to content

Instantly share code, notes, and snippets.

@blickwert
Created March 25, 2015 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blickwert/c93c52089a5e01b70395 to your computer and use it in GitHub Desktop.
Save blickwert/c93c52089a5e01b70395 to your computer and use it in GitHub Desktop.
set custom Sidebar for Woocommerce in Genesis
/**
*
* set sidebar for woocommerce
* @author David Wögerer
* @since 2.1.2
*
*/
add_action('get_header','dato_change_genesis_sidebar');
function dato_change_genesis_sidebar() {
if ( is_woocommerce() || is_product() ) {
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
add_action( 'genesis_sidebar', 'dato_do_sidebar' );
}
}
// Register new sidebar
genesis_register_sidebar( array(
'id' => 'woocommerce-sidebar',
'name' => 'Woocommerce Sidebar',
'description' => 'This is the sidebar for woocommerce.',
) );
//Function to output my custom sidebar
function dato_do_sidebar() {
dynamic_sidebar( 'woocommerce-sidebar' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment