php - 无法删除 WooCommerce 图像缩放

标签 php wordpress woocommerce content-management-system

我正在尝试从使用 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/

相关文章:

php - 安全表数据输入 PHP/PDO/MySQL

php - Cakephp 中的 UNION 语法

php - 更有效的方法来聚合和重新列列结果?

php - 根据 WooCommerce 购物车中的运输类别显示自定义文本

php - WooCommerce 购物车 Hook 'woocommerce_cart_contents' 在错误的位置显示内容

php - 将自定义 URL 链接添加到 WooCommerce 中的管理订单列表页面

java - 序列化与防止按钮、链接等被点击两次有什么关系吗?

php - 为 10000 多条记录分配随机顺序

php - WordPress 自定义提交按钮

javascript - 检查输入中的值-Google Maps自动完成