Skip to content

Instantly share code, notes, and snippets.

@lots0logs
Created December 18, 2015 01:10
Show Gist options
  • Save lots0logs/3a9b8b62d09e432f3ce5 to your computer and use it in GitHub Desktop.
Save lots0logs/3a9b8b62d09e432f3ce5 to your computer and use it in GitHub Desktop.
Divi - Custom Sidebar For WooCommerce Pages
<?php /* Don't include this line if your child theme functions.php already includes it */
function my_et_divi_output_content_wrapper_end() {
echo '</div> <!-- #left-area -->';
if (
( is_product() && 'et_full_width_page' !== get_post_meta( get_the_ID(), '_et_pb_page_layout', true ) )
||
( ( is_shop() || is_product_category() || is_product_tag() ) && 'et_full_width_page' !== et_get_option( 'divi_shop_page_sidebar', 'et_right_sidebar' ) )
) {
dynamic_sidebar( 'eCommerce Sidebar' );
}
echo '
</div> <!-- #content-area -->
</div> <!-- .container -->
</div> <!-- #main-content -->';
}
function my_et_woocommerce_custom_sidebar() {
remove_action( 'woocommerce_after_main_content', 'et_divi_output_content_wrapper_end', 10 );
add_action( 'woocommerce_after_main_content', 'my_et_divi_output_content_wrapper_end', 10 );
}
add_action( 'after_setup_theme', 'my_et_woocommerce_custom_sidebar', 50 );
/* Don't include this line if your child theme functions.php already includes it */ ?>
@jimboobrien
Copy link

Nice, dude! I was looking for this everywhere.

I had to add an echo before and after your dynamic_sidebar() call to include a div with a id of 'sidebar'.

I'll post my CSS I'm about to create if I get around to it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment