Created
March 27, 2018 15:18
-
-
Save madeincosmos/85b0fdaa84912e583dadcbd183ff3ea0 to your computer and use it in GitHub Desktop.
Make all product images in WooCommerce 3.3 square and cropped
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function woo_custom_single_image_size ( $size ) { | |
$size['height'] = $size['width']; | |
$size['crop'] = 1; | |
return $size; | |
} | |
add_filter('woocommerce_get_image_size_single', 'woo_custom_single_image_size', 50, 1); | |
add_filter('woocommerce_get_image_size_shop_single', 'woo_custom_single_image_size', 50, 1); | |
add_filter('woocommerce_get_image_size_thumbnail', 'woo_custom_single_image_size', 50, 1); | |
add_filter('woocommerce_get_image_size_gallery_thumbnail', 'woo_custom_single_image_size', 50, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment