Php if statement for displaying a picture
-
I have a custom variable that denotes the URL of a picture I’m looking for, the problem is that it is displaying a blank box for the articles that don’t have a photo included. My question is, can someone help me create an if statement in PHP that can check the value of the variable, and only place the code for the image if the variable is NOT “” (blank).
Here’s the code, should be everything that someone needs, I just don’t know Php really at all, so it’s tough for me:
<img src="<?php $values = get_post_custom_values("MainFeaturedPost"); echo $values[0]; ?>" style="float: left; width: 517px" alt="" /> <div id="photocreds"> Credit: <?php $values = get_post_custom_values("photocreds"); echo $values[0]; ?> </div>
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Php if statement for displaying a picture’ is closed to new replies.