skip to Main Content

Snippet: Custom Sidebar for Woo Product Categories Only

Important: Since Total 5.2.1 you can add and assign custom sidebars under Appearance > Widgets without any need for custom code!

// Register new custom sidebar
add_filter( 'wpex_register_sidebars_array', function( $sidebars ) {
	$sidebars['woo_category_sidebar'] = __( 'WooCommerce Category Sidebar', 'total' );
	return $sidebars;
} );

// Show the new sidebar for categories
add_filter( 'totaltheme/sidebars/primary/name', function( $sidebar ) {
	if ( is_tax( 'product_cat' ) ) {
		return 'woo_category_sidebar';
	return $sidebar;
}, 100 );
All PHP snippets should be added via child theme's functions.php file or via a plugin (we recommend WPCode)
Back To Top