Could you show your function please?
Thanks, It’s to add a sidebar to the WooCommerce product pages in the Web Savvy ‘Jessica’ theme.
// Remove forced full width layout for single products
remove_filter( 'genesis_site_layout', 'jessica_woo_product_layout' );
// Use alternate sidebar function
remove_action( 'get_header', 'wsm_child_sidebars_init', 15 );
add_action( 'get_header', 'wsm_alt_child_sidebars_init', 15 );
/**
* Remove sidebars
*/
function wsm_alt_child_sidebars_init() {
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );
remove_action( 'genesis_sidebar', 'ss_do_sidebar' );
remove_action( 'genesis_sidebar_alt', 'ss_do_sidebar_alt' );
remove_action( 'genesis_sidebar', 'gencwooc_ss_do_sidebar' );
remove_action( 'genesis_sidebar_alt', 'gencwooc_ss_do_sidebar_alt' );
add_action( 'genesis_sidebar', 'jessica_alt_child_do_sidebar' );
}
function jessica_alt_child_do_sidebar() {
if ( $id = jessica_child_has_ss_sidebar() ) {
if ( dynamic_sidebar( $id ) ) { /* do nothing */ }
}
elseif ( class_exists( 'Woocommerce' ) ) {
if( is_shop() || is_product_category() || is_product_tag() || is_product() ) {
genesis_widget_area( 'store-sidebar');
}
elseif( is_archive() || is_single() || is_category() || is_page_template( 'page_blog.php' ) ) {
genesis_widget_area( 'blog-sidebar');
}
else genesis_widget_area( 'page-sidebar');
}
elseif ( class_exists( 'IT_Exchange' ) ) {
if( it_exchange_is_page() || is_tax( 'it_exchange_category') || is_tax() ) {
genesis_widget_area( 'store-sidebar');
}
elseif( is_archive() || is_single() || is_category() || is_page_template( 'page_blog.php' ) ) {
genesis_widget_area( 'blog-sidebar');
}
else genesis_widget_area( 'page-sidebar');
}
elseif ( class_exists( 'WP_eCommerce' ) ) {
if( wpsc_is_in_category() || wpsc_is_product() || wpsc_is_single_product() || is_page( 'products-page') || is_tax() ) {
genesis_widget_area( 'store-sidebar');
}
elseif( is_front_page() || is_home() || is_archive() || is_single() || is_category() || is_page_template( 'page_blog.php' ) ) {
genesis_widget_area( 'blog-sidebar');
}
else genesis_widget_area( 'page-sidebar');
}
else {
if( is_archive() || is_single() || is_category() || is_page_template( 'page_blog.php' ) ) {
genesis_widget_area( 'blog-sidebar');
}
else genesis_widget_area( 'page-sidebar');
}
}
Thanks. Unfortunately I can’t test your code because the Web Savvy ‘Jessica’ theme is paid. I can’t buy a theme just to check the compatibility of my plugin with this theme. At first glance, this code looks OK and should work with my plugin. I will think with what could be the problem, and if I’ll be able to find the cause, then I will definitely make the plugin update to fix this problem.
Regards,
Arthur
Thanks Arthur, I understand entirely. I thought the problem might be very clear to you when you saw it, but no worries. I’ll go back to using functions.php.
Hi @philraymond, you might want to try the Genesis Extender plugin:
https://cobaltapps.com/downloads/genesis-extender-plugin/
I’m using it for my genesis sites, it works great.