我正在使用Woocommerce 4.2.0和Storefront的子主题。在产品页面中,我要使缩略图图像与主图像一样大(692像素)。
我在我的functions.php中有这个:
/**
* Modify image width theme support.
*/
function iconic_modify_theme_support() {
$theme_support = get_theme_support( 'woocommerce' );
$theme_support = is_array( $theme_support ) ? $theme_support[0] : array();
$theme_support['single_image_width'] = 692;
// $theme_support['thumbnail_image_width'] = 324;
remove_theme_support( 'woocommerce' );
add_theme_support( 'woocommerce', $theme_support );
}
add_action( 'after_setup_theme', 'iconic_modify_theme_support', 100 );
已更新-以下内容将动态:
编码:
add_filter( 'woocommerce_single_product_flexslider_enabled', '__return_false' ); // Disable slider
add_filter( 'woocommerce_single_product_zoom_enabled', '__return_false' ); // Disable zoom
// Set gallery thumbnails size from single product main image size
add_filter( 'woocommerce_gallery_thumbnail_size', 'filter_gallery_thumbnail_size' );
function filter_gallery_thumbnail_size( $indexed_size ){
// Get single product main image size
$indexed_size = wc_get_image_size( 'woocommerce_thumbnail' );
return array( $indexed_size['width'], $indexed_size['height'] );
}
代码进入您的活动子主题(或活动主题)的functions.php文件中。经过测试和工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句