简体   繁体   English

如何显示woocommerce产品属性的图像?

[英]How to show image of woocommerce product attribute?

I installed Taxonomy Images plugin and added images to one of my attributes, but I can't get them to be shown in template. 我安装了Taxonomy Images插件,并将图像添加到了我的属性之一,但是我无法让它们显示在模板中。 When I var_dump the $result of: 当我var_dump的$ result:

$result = apply_filters( 'taxonomy-images-queried-term-image', '' );

I get an empty string. 我得到一个空字符串。

I can get the value of attribute by: 我可以通过以下方式获取属性的值:

$product->get_attribute( 'logo' );

But there's only string, not an object. 但是只有字符串,没有对象。

How can I get it to work? 我如何使它工作?

Taxonomy Images plugin allows to add Image support for taxonomy. 分类法图像插件允许添加对分类法的图像支持。 WooCommerce Attributes is not Custom Taxonomy. WooCommerce属性不是自定义分类法。

Also, verify you added above code in, taxonomy archive template. 另外,请确认您在分类档案模板中添加了以上代码。 If it is used in, unsupported template file it returns empty string. 如果在不受支持的模板文件中使用它,则返回空字符串。

Hope this helps. 希望这可以帮助。

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

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