我正在尝试获取带有woocommerce类别图像的父类别标题,我只获得了一个特定类别,可以说我只想获得类别ID和类别ID'18'或类别块'demo'的图像,我能够仅通过以下代码即可获得我对子类别的要求
<?php
$catTerms = get_terms('product_cat', array(
'hide_empty' => 0,
'orderby' => 'ASC',
'child_of'=>'17'
));
foreach($catTerms as $catTerm) :
$term_link = get_term_link( $prod_cat, 'product_cat' );
?>
<?php $thumbnail_id = get_woocommerce_term_meta( $catTerm->term_id, 'thumbnail_id', true );
// get the image URL
$image = wp_get_attachment_url( $thumbnail_id );
$term_link = get_term_link( $catTerm, 'product_cat' );
?>
<div class="col-md-4">
<a href="<?php echo $term_link ?>">
<div class="bling-wrapper">
<div class="bling-image">
<img src="<?php echo $image; ?>" />
<div class="shop-bling">
shop Now
</div>
</div>
<div class="bling-title">
<h3><?php echo $catTerm->name; ?></h3>
</div>
</div>
</a>
</div>
<?php endforeach; ?>
但是我想通过ID或Slug(带有标题和图像)显示父类别而没有子类别,我该如何实现这一目标....