Images in if-else

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.
Share This Post

6 thoughts on “Images in if-else

  1. Pingback: facebook

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.