How can I write a simple conditional statement to test if a post has tags? I want to hide part of my layout if the tags for a post are empty.
How can I write a simple conditional statement to test if a post has tags? I want to hide part of my layout if the tags for a post are empty.
A wild shot:
<?php
$hastags = get_the_tags();
if ( $hastags ) {
//Your elements when post has tags
}
?>
Not tested.
You must log in to post.