【发布时间】:2019-10-03 10:29:36
【问题描述】:
我在显示子类别的缩略图时遇到了一些问题。谁能帮帮我?
<?php
$terms = get_the_terms( $post->ID, 'product_cat' );
foreach ( $terms as $term ){
$category_name = $term->name;
$category_thumbnail = get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true);
$image = wp_get_attachment_url($category_thumbnail);
echo '<img src="'.$image.'">';
}?>
我只想显示 SUBCATEGORY 的缩略图,上面的代码对这个问题没有帮助。谢谢
【问题讨论】:
标签: php wordpress woocommerce