admin管理员组

文章数量:1391985

I changed on two specific category layout to 3 and 2 columns. Now i can't figure out how can i change picture sizes on these categories, at moment they are upscaled and quality is low.

add_filter( 'subcategory_archive_thumbnail_size', function( $size ) {
    if ( function_exists( 'is_product_category' ) && is_product_category( 'twilight' ) ) {
        return 'full';
    }

    return $size;
} );

Code used to change category columns

add_filter('loop_shop_columns', 'loop_columns'); 
if (!function_exists('loop_columns')) {
    function loop_columns() {
        if ( is_product_category('a')) {
            return 3;
        } else if ( is_product_category('b')) {
            return 2;
        }else{
            return 6;   
        }
    }
}

I changed on two specific category layout to 3 and 2 columns. Now i can't figure out how can i change picture sizes on these categories, at moment they are upscaled and quality is low.

add_filter( 'subcategory_archive_thumbnail_size', function( $size ) {
    if ( function_exists( 'is_product_category' ) && is_product_category( 'twilight' ) ) {
        return 'full';
    }

    return $size;
} );

Code used to change category columns

add_filter('loop_shop_columns', 'loop_columns'); 
if (!function_exists('loop_columns')) {
    function loop_columns() {
        if ( is_product_category('a')) {
            return 3;
        } else if ( is_product_category('b')) {
            return 2;
        }else{
            return 6;   
        }
    }
}
Share Improve this question asked Jan 24, 2020 at 11:57 ufo56ufo56 1
Add a comment  | 

1 Answer 1

Reset to default 0

You can use category id using

if ( is_product_category('your category id') ){
 Change your product size
 }

Please refer to this LINK

本文标签: Change woocommerce one category image size