Getting taxonomy term for each listed post

I have a list of the latest posts (custom post type). In each list item, I have the title of the post and an image. I’d like to show the term name that the post is a part of. How would I go about doing that? In the code I have CUSTOM TAXONOMY TERM NAME HERE where I’d like to show the term.

                    $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="" 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>

                                        <li><span>Category: CUSTOM TAXONOMY TERM NAME HERE</span> </li>

                                            $songDifficulty = get_field('song_difficulty');
                                            if ($songDifficulty > 0) : ?>
                                                <li><span>Song Level:</span> <?php echo $songDifficulty ?></li>
                                            <?php endif; ?>

                                    <a href="<?php echo get_permalink(); ?>" class="cta cta--primary cta--chevron-right cta--block">View Lesson</a>

Read more here: Getting taxonomy term for each listed post

Leave a Reply

Your email address will not be published. Required fields are marked *