Im trying to display an image in a conditional statement.
Without the condition I can simply do:
<div>
<img src="<?php echo($img); ?>" />
</div>
But lets say that i have condition like this:
<?php
if ($img ) {
echo "image exists";
// Show image
} else {
echo "no image..";
}
?>
I am using wordpress and the $img
contains a url.
Help appreciated. Thank you!
Try:
You can use like