/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $thereisimage = get_post_meta($post->ID, image, true); if($thereisimage){ ?> <a href="<?php the_permalink() ?>"><img src="<?php echo get_post_meta($post->ID, image, true); ?>" alt="Image" /></a> <?php }else{ ?> <a href="<?php the_permalink() ?>"><img src="images/default.png" alt="Default Image" /></a> <?php } ?>
URL: http://forthelose.org/how-to-use-custom-fields-in-wordpress