Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add custom sidebar to WooCommerce pages
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Remove default sidebar, add shop sidebar
add_action( 'genesis_before', 'wpstudio_add_woo_sidebar', 20 );
function wpstudio_add_woo_sidebar() {
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
if( is_woocommerce() ) {
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );
add_action( 'genesis_sidebar', 'wpstudio_woo_sidebar' );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment