简体   繁体   English

禁用 woocommerce 产品的链接

[英]Disabling the link of a woocommerce product

I have been trying for a while now to remove the image link from a Woocommerce product.我一直在尝试从 Woocommerce 产品中删除图像链接。 I tried snippets, css and plugins.我尝试了片段、css 和插件。 But nothing seems to work, until I came across Vitaly Gritsienko's answer of Jul 5 2017.但似乎没有任何效果,直到我遇到 Vitaly Gritsienko 在 2017 年 7 月 5 日的回答。

Although the code he suggests (see below) for the functions.php file works, the hand icon is still visible.尽管他为functions.php文件建议的代码(见下文)有效,但手形图标仍然可见。 How can I remove the hand icon?如何删除手形图标?

 //Removes links
 add_filter( 'woocommerce_product_is_visible','product_invisible');
 function product_invisible(){
 return false;
}

//Remove single page
add_filter( 'woocommerce_register_post_type_product','hide_product_page',12,1);
function hide_product_page($args){
$args["publicly_queryable"]=false;
$args["public"]=false;
return $args;
}

Actually, the simplest way is to edit the theme's woocommerce listing page to remove the link from the templating engine, although it's better to do it via a child theme so as not to interfere with the main theme's updates.实际上,最简单的方法是编辑主题的 woocommerce 列表页面以从模板引擎中删除链接,尽管最好通过子主题来完成,以免干扰主主题的更新。

You can read more about child themes here: https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/您可以在此处阅读有关子主题的更多信息: https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM