I have a problem to hide a div when the input of a custom field is empty. This is the code I am using, it's fine when the field is not empty. But when the fireld empty, the div will show.
The field that displays the content is postintro2, the div I want to hide when empty is
<div class="single2-intro">
The complete codes is:
<?php { $postintro2 = get_post_meta ($post->ID, 'postintro2', $single = true);
if($postintro2 !== '')
echo '<div class="single2-intro">'.$postintro2.'</div>';
} ?>
Thanks for any helps.