I'm using the following function to return a list of custom post types, with the_terms
showing a taxonomy term.
function projectCards() {
$args = array( 'post_type' => 'rneh_projects', 'posts_per_page' => 6 );
$loop = new WP_Query( $args );
echo '<ul>';
while ( $loop->have_posts() ) : $loop->the_post();
echo '<li class="project-card d-1of3 cf">';
the_terms( $post->ID, 'rneh_status', ' ', ' ' );
echo '<p><a href="' . get_post_permalink() . '">' . get_the_title() . '</a></p>';
the_terms( $post->ID, 'rneh_author', ' ', ' , ' );
echo '</li>';
endwhile;
echo '</ul>';
}
On the face of it this does what I want it to do, but then in trying to wrap
the_terms( $post->ID, 'rneh_status', ' ', ' ' );
in a span, like
echo '<span>' . the_terms( $post->ID, 'rneh_status', ' ', ' ' ) . '</span>';
so I can target it for styling, the output places the taxonomy term outside of the span, like this.
<a href="http://localhost/ne-heritage/research/ongoing/" rel="tag">Ongoing</a>
<span></span>
How do I get the output to show the term inside the span and add a class with the term name to it, or, add a class of the term name to the a href already wrapping the term name?