It must be easy for a wordpress developer/ Php guy and I am not a Php guy. Please point me to the right direction. I have the below code in single.php <img src="<?php $values = get_post_custom_values("thumbs"); echo $values[0]; ?>" width="250" height="180" class="thumb-new" alt="" /> Code (markup): when I add an image URL using custom field it shows the image. Now that image has Border around using CSS. And when there is no image URL mention it still renders the code <img src'" "> I want when there is no value (img URL) mentioned in Custom Field it shouldn't render the <img src> Code. Thanks in advance.
try this <?php $values = get_post_custom_values("thumbs"); if(!empty($values[0])) { ?> <img src="<?php echo $values[0]; ?>" width="250" height="180" class="thumb-new" alt="" /> <?php } ?> PHP: