Last active
July 17, 2021 04:12
-
-
Save frankschrijvers/4f48bad747ad94ab2607 to your computer and use it in GitHub Desktop.
Add custom sidebar to WooCommerce pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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