【问题标题】:Can't remove WooCommerce's image zoom无法删除 WooCommerce 图像缩放
【发布时间】:2018-06-05 15:55:10
【问题描述】:

我正在尝试从使用 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' );
}

我花了一些时间在谷歌上搜索,但答案总是建议尝试上述方法。

【问题讨论】:

    标签: php wordpress woocommerce content-management-system


    【解决方案1】:

    我禁用所有图像效果:

    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检查了它

    【讨论】:

    • 您通过哪种方式添加了 woocommerce 支持?
    • 什么意思?我刚刚添加了我对functions.php的回答中的代码
    • 如果您有自定义主题,则必须声明对 woocommerce 的支持。有两种方法可以做到这一点。你做过哪一个?
    • 检查我的答案。
    【解决方案2】:

    对我有用的解决方案是将以下内容添加到您的 functions.php 文件中

    // Add WooCommerce support
    function add_woocommerce_support() {
        add_theme_support( 'woocommerce' );
    }
    
    add_action( 'after_setup_theme', 'add_woocommerce_support' );
    

    【讨论】:

      猜你喜欢
      • 2014-12-23
      • 1970-01-01
      • 2014-01-24
      • 1970-01-01
      • 2022-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多