I'm currently using custom fields to display thumbnails on my homepage. Here is the code I am using below:
<img src="<?php echo get_post_meta($post->ID, "Thumbnail", true); ?>" alt="alt text" />
Basically what I want to know is how to display a default image should custom field be left blank and an image is not specified.
I haven't tried but something like this should work:
<?php if( get_post_meta($post->ID, "Thumbnail", true) ): ?>
<img src="<?php echo get_post_meta($post->ID, "Thumbnail", true); ?>" alt="alt text" />
<?php else: ?>
<img src="default.jpg" alt="alt text" />
<?php endif; ?>
Worked beautifully - thanks SO much for saving me time!
Can a default image be displayed if an image is not found?