如何去除Woocommerce中的表情放大镜

如何去除Woocommerce中的表情放大镜,woocommerce,emoji,Woocommerce,Emoji,我尝试的是: remove_action('wp_head', 'print_emoji_detection_script', 7); remove_action('wp_print_styles', 'print_emoji_styles'); 在css中: .woocommerce-product-gallery__trigger img { display: none !important; ---///this works in chrome but not in mozilla }

我尝试的是:

remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
在css中:

.woocommerce-product-gallery__trigger img {
display: none !important; ---///this works in chrome but not in mozilla
} 在js中,我尝试了不使用setTimeout和使用setTimeout:

 setTimeout(() => {
    $('woocommerce-product-gallery__trigger').find('img').removeAttr('alt');
    $('woocommerce-product-gallery__trigger').empty() ---////this tried when remove supports emoji in WP(see first 2 remove_action())
    $('woocommerce-product-gallery__trigger').contents().remove()---////this tried when remove supports emoji in WP(see first 2 remove_action())
  },2000)
我还访问了woocommerce plugin assets/js/single-product.js,从
this.$target.prepend(“”)


但我仍然有这样的想法:

这是我所做的,并不理想,但

setTimeout(() => {$('.woocommerce-product-gallery__trigger').find('img').detach();
$('.woocommerce-product-gallery__trigger').text(' ');
},1000)

setTimeout()
是必需的,也许最好在设置主题后将其放入
钩子中,不带setTimeout,但这对我很有用。

如果您想删除放大镜图标并禁用产品页面上的缩放功能,您可以按照以下完整教程操作:

编辑woocommerce.css

使用FTP协议连接到您的网站,然后转到/youwebsite.com/wp-content/plugins/woocommerce/assets/css/woocommerce.css

使用文本编辑器工具编辑此文件并查找类:
.woocommerce div.product div.images.woocommerce-product-gallery\u触发器
,添加显示:无;这节课的内容如下:

.woocommerce div.product div.images .woocommerce-product-gallery__trigger {
    display: none;
    position: absolute;
    top: .5em;
    right: .5em;
    font-size: 2em;
    z-index: 9;
    width: 36px;
    height: 36px;
    background: #fff;
    text-indent: -9999px;
    border-radius: 100%;
    box-sizing: content-box;
}
您还可以使用子主题的css文件隐藏放大镜图标

.single-product .woocommerce-product-gallery .woocommerce-product-gallery__trigger {
display: none;
}