Skip to content

Instantly share code, notes, and snippets.

@frankschrijvers
Last active July 17, 2021 04:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frankschrijvers/4f48bad747ad94ab2607 to your computer and use it in GitHub Desktop.
Save frankschrijvers/4f48bad747ad94ab2607 to your computer and use it in GitHub Desktop.
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