我正在尝试从使用 WooCommerce 的自定义主题网站中删除图像缩放。这是我尝试在我的 functions.php 文件中添加的内容:
add_action( 'after_setup_theme', 'remove_pgz_theme_support', 100 );
function remove_pgz_theme_support() {
remove_theme_support( 'wc-product-gallery-zoom' );
}
还有这个
add_action( 'wp', 'remove_pgz_theme_support', 20 );
function remove_pgz_theme_support() {
remove_theme_support( 'wc-product-gallery-zoom' );
}
我花了一些时间在谷歌上搜索,但答案总是建议按照上述思路尝试一些事情。
最佳答案
我禁用所有图像效果:
add_action('wp', 'remove_woo_image_effects');
function remove_woo_image_effects() {
// this should be disable the gallery slider and lightbox
remove_theme_support('wc-product-gallery-lightbox');
remove_theme_support('wc-product-gallery-slider');
// this should be disable the zoom
remove_theme_support('wc-product-gallery-zoom');
}
我用 DIVI 和我的自定义主题中的两个对其进行了测试
在这里用custom theme检查过
关于php - 无法删除 WooCommerce 图像缩放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50704326/