wordpress help
Out of context: Reply #6
- Started
- Last post
- 17 Responses
- bort0
<?php if (get_post_meta($post->ID, 'image-1', true) ) { ?>
<img src="<?php echo get_post_meta($post->ID, 'image-1', true); ?>" width="150" height="150" ></li>
<?php } ?><?php if (get_post_meta($post->ID, 'image-2', true) ) { ?>
<img src="<?php echo get_post_meta($post->ID, 'image-2', true); ?>" width="150" height="150" ></li>
<?php } ?><?php if (get_post_meta($post->ID, 'image-3', true) ) { ?>
<img src="<?php echo get_post_meta($post->ID, 'image-3', true); ?>" width="150" height="150" ></li>
<?php } ?>The conditionals (if statements) are there so if you don't want to include the images on a certain page then they aren't output. If you know you're going to have an absolute number of images on every page then feel free to remove the if statements.
These have to be used in the loop.