Return to Snippet

Revision: 18219
at September 23, 2009 16:04 by paulgrenwood


Initial Code
<?php $postimageurl = get_post_meta($post->ID, 'Image', true);
if ($postimageurl) {
?>
<img src="/wp-content/themes/NomeMag/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, "Image", true); ?>
&h=250&w=250&zc=1" alt="">
<?php } else { ?>
<img src="/wp-content/themes/NomeMag/images/wpshoutlogo.jpg" alt="WPShout.com | No image available" />
(don't have a line break, just so it's readable)
<?php } ?>

Initial URL


Initial Description
Whilst there are a number of ways of displaying thumbnails, this is still my favourite (even if it does require the most work!). First, upload timthumb to /wp-content/themes/yourtheme/ and create an image 250px by 250px with your site’s logo and upload it to yourtheme/images/. This is the image that will be displayed if no custom field is displayed. Then, for every thumbnail, you’ll need to create it in Photoshop and upload it to your blog. Next, create a custom field ‘Image’ with the path of the image as the value of the custom field. Now for the code:

Initial Title
Custom Fields - Display a thumbnail (and auto resize it)

Initial Tags
wordpress

Initial Language
PHP