我有最新帖子列表(自定义帖子类型)。在每个列表项中,我都有帖子的标题和图像。我想显示帖子所属的术语名称。我该怎么做呢?在代码中我有CUSTOM TAXONOMY TERM NAME,我想在这里显示这个词。
<?php
$args = array(
'post_type' => 'lessons',
'posts_per_page' => 4,
'order'=> 'ASC',
'orderby' => 'title',
'taxonomy' => 'lesson-type'
);
$postslist = get_posts( $args );
foreach ( $postslist as $post ) : setup_postdata( $post ); ?>
<div class="col-sm-6 col-md-3">
<div class="panel panel--lesson">
<img src="http://placehold.it/640x360" alt="<?php the_title() ?>" class="video-thumb img-responsive" data-vimeo-id="<?php the_field('vimeo_id') ?>">
<div class="panel-body">
<h3><?php the_title() ?></h3>
<ul>
<li><span>Category: CUSTOM TAXONOMY TERM NAME HERE</span> </li>
<?php
$songDifficulty = get_field('song_difficulty');
if ($songDifficulty > 0) : ?>
<li><span>Song Level:</span> <?php echo $songDifficulty ?></li>
<?php endif; ?>
</ul>
<a href="<?php echo get_permalink(); ?>" class="cta cta--primary cta--chevron-right cta--block">View Lesson</a>
</div>
</div>
</div>
<?php
endforeach;
wp_reset_postdata();
?>