Hide box if no thumbnail
-
I have the following code that display thumbnail and excerpt in the homepage. It will auto retrieve the first image in a post and convert to a thumbnail. However, I don’t know how to hide the thumbnail box if there’s no image in a post. Currently it will show empty box because there’s no image in the post and thus, no thumbnail generated.
Hoping someone could let me know how to solve the problem
Thank you very much
<div class=”boxitem”>
<h5>” ><?php the_title() ?></h5>
<span class=”itemdets”>
Posted On: “><?php the_time(‘j F Y’); ?>
</span>
<div class=”thumbnail”>” title=”<?php the_title_attribute(); ?>”>
<img src=”<?php bloginfo(‘template_directory’); ?>/timthumb.php?src=<?php getImage(‘1’); ?>&w=120&h=120&zc=1″>
</div>
<?php the_content_rss(”, TRUE, ”, 25); ?>
<span class=”morelink”>
“>Read More…
</span>
</div>
The topic ‘Hide box if no thumbnail’ is closed to new replies.