Hello, I would like to make my shop page full-width with two products per row, but enable a sidebar on left on product category archive pages. I have made the changes for the shop page via Pro’s theme options, but how can I enable the left sidebar on product category archives?
I tried to use the following code, but it adds an empty sidebar to the shop page when I don’t want one there:
/* Enable product filter sidebar on category archives */
function x_get_content_layout() {
$content_layout = x_get_option( 'x_layout_content' );
if ( $content_layout != 'full-width' ) {
if ( x_is_product_category() || x_is_product_tag() ) {
$opt = x_get_option( 'x_woocommerce_shop_layout_content' );
$layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
} elseif ( is_archive() ) {
$layout = $content_layout;
}
} else {
$layout = $content_layout;
}
if ( x_is_product_category() || x_is_product_tag() ) {
$layout = 'content-sidebar';
}
return $layout;
}
Any insight into this? Thank you!