Images in if-else

If you want to see different type of image & size in different post then you may use following code-
< ?php if ($image = get_post_meta($post->ID, ‘slide’, true)) { ?>
<img width=”617″ height=”350″ src=”<?php echo $image; ?>” alt=”Image” />
< ?php } else { ?>
< ?php $image = get_post_meta($post->ID, ‘simg’, true) ; ?>
<img width=”80″ height=”70″ src=”<?php echo $image; ?>” alt=”Small Image” />
< ?php } ?>
I use this code to (www.hdcbd.com) so show small image in category view and single page use big image.

1 thoughts on “Images in if-else

Leave a Reply

Your email address will not be published. Required fields are marked *