Display specific content if post has_tag or specific tag

Adding this snippet within the loop of your wordpress template will let you display specific content if a post has tags or not. Also note that has_tag(‘tag_name’) suports, tag name, term_id or slug and an array of tag names, term ids and slugs. Also a big thanks to Jeremy for submitting the following.

 

 

<?php
if(has_tag()){
echo 'this post has tags';
}else {
echo 'no tags sorry';
}
?>

Leave a comment