Return to Snippet

Revision: 20293
at November 11, 2009 11:40 by thehamilton


Initial Code
<?php $postimageurl = get_post_meta($post->ID, 'post-img', true);
if ($postimageurl) {
?>
      <a href="<?php the_permalink(); ?>" rel="bookmark"><img src="<?php echo $postimageurl; ?>" alt="Post Pic" width="200" height="200" /></a>
<?php } else { ?>
      <a href="<?php the_permalink(); ?>" rel="bookmark"><img src="<?php bloginfo('template_url'); ?>/images/wprecipes.gif" alt="Screenshot" width="200" height="200" /></a>
<?php } ?>

Initial URL

                                

Initial Description
Start by creating a default image in Photoshop or Gimp. The size in my example is 200×200 pixels but is of course up to you. Name the image default.gif.

Upload your default.gif image to the image directory in your theme.

Open the index.php file and paste in the following code where you’d like the thumbnails to be displayed:

Save the file.

In each of your posts, create a custom field called post-img. Set its value as the URL of the image you’d like to display as a thumbnail.

Initial Title
Display Thumbnails Next To Your Posts

Initial Tags

                                

Initial Language
PHP