One of the features of Wordpress 2.9 was the addition of support for Thumbnails in posts. One of the frequent question we get is How do I show thumbnails in posts?
If your theme supports thumbnails then on the post edit page you will see a Post Thumbnail box at the bottom of the right column.
If your theme doesn't 'natively' support thumbnails - you can fix it with a few lines of code.
The first thing to do is to locate the functions.php file in your theme directory and add the following snippet:
if ( function_exists( 'add_theme_support' ) ) add_theme_support( 'post-thumbnails' );
If you dont have a functions.php file then create one and add the following:
<?php
if ( function_exists( 'add_theme_support' ) ) add_theme_support( 'post-thumbnails' );
?>The you should see the post Thumbnail box in the post edit page.
You theme can be updated to actaully show the thumbnail by adding the following code to the index.php page.
Locate a suitable place for the image to appear:
<?php if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) {?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(); ?></a>
<?php
} else {?>
<?php $thumbimage = get_post_meta($post->ID, 'thumbnail', true);
if ($thumbimage) {?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><img src="<?php echo $thumbimage; ?>" alt="" /></a>
<?php }
} ?>