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.
Muhammad Faridul Islam is an entrepreneur, web developer, and IT Consultant. Besides his profession, he also writes a blog here.

6 Responses to Images in if-else

  1. oto kiralama…

    I feel that is a fascinating point,…

  2. facebook says:

    facebook…

    WAw some blog! I am loving it*…..

  3. […] Images in if-else | Source and Code var a2a_config = a2a_config || {}; a2a_config.linkname="Cool Aging Article images"; a2a_config.linkurl="http://Aging.booksharecentral.net/2010/Aging-article/cool-aging-article-images-21/&quot;; […]

  4. […] Images in if-else | Source and Code var a2a_config = a2a_config || {}; a2a_config.linkname="Cool History Books images"; a2a_config.linkurl="http://History.booksharecentral.net/2010/History-books/cool-history-books-images-39/&quot;; […]

Leave a Reply

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