I want to show plain text tag names above each post on a page that displays posts for a given category. Each post only has one tag.
I've set up an array to grab posts from the category I want and made my WP_Query query. The posts display in nice div's, with their titles, content, etc.. My problem is those darn tags!
I can display each post's tag name using this:
But this serves up
<a href="[link to tag page]" rel="tag">[My Tag Name]</a>
I've tried variations of strip_tags and several functions in the Wordpress Codex on
the_tags() to remove the html - all to no avail.
I am able to strip out the html using the next method (displaying plain text, hooray!), but unfortunately every post adds tag names to the short array
$term_names and the list of tags displayed next to each post grows with every post.
$terms = wp_get_post_tags( $post->ID ); foreach( $terms as $term ) $term_names = $term->name; echo implode( ', ', $term_names );
Is there something I am missing? Clearly there must be.