【发布时间】:2017-12-30 04:28:41
【问题描述】:
我正在使用插件 WooCommerce Variation Swatches and Photos 让我可以为我的产品属性添加缩略图。
我需要列出模板上的所有属性,并且还想获取并显示缩略图。
$terms = get_terms( array(
'taxonomy' => 'pa_texture',
'hide_empty' => false,
) );
foreach ( $terms as $term ) {
print_r($term);
}
WooCommerce 中的缩略图功能不是默认功能,因此当我 print_r $term 时没有缩略图 URL:
WP_Term Object
(
[term_id] => 54
[name] => Guilin
[slug] => guilin
[term_group] => 0
[term_taxonomy_id] => 54
[taxonomy] => pa_texture
[description] => Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla imperdiet facilisis convallis.
[parent] => 0
[count] => 2
[filter] => raw
[meta_value] => 0
)
如何获取属性的缩略图?
【问题讨论】:
标签: wordpress plugins woocommerce attributes thumbnails