Most WordPress theme are using custom fields to display thumbs on their blog homepage.
But you can take easily extract the first image from the post, and display the image as post thumbnail.
Just copy paste the following function in your functions.php file.
function get_first_image($id) {
$PostID = $id;
$all_images =& get_children('post_type=attachment&post_mime_type=image&post_parent=' . $PostID );
if($all_images) {
$arr_of_all_images = array_keys($all_images);
// Get the first image attachment from post
$firstImage = $arr_of_all_images[0];
// Get the thumbnail url for the attachment
// If you want the full-size image instead of the thumbnail, use wp_get_attachment_url() instead of wp_get_attachment_thumb_url().
$thumb_url = wp_get_attachment_thumb_url($firstImage);
// Build the <img> string
$First_thumb_image = '<a href="' . get_permalink() . '">' .
'<img src="' . $thumb_url . '" width="150" height="150" alt="Thumbnail Image" title="Thumbnail Image" />' .
'</a>';
// Print the thum image form post
echo $First_thumb_image;
}
}
You can call above “get_first_image” function anywhere in your post loop. I loop you need to just copy paste the following lines
to print the first image of post body.
<?php get_first_image($post->ID); ?>

Follwing article I found useful
http://codex.wordpress.org/Plugin_API/Filter_Reference
http://codex.wordpress.org/Function_Reference/wp_get_attachment_thumb_url
Incoming search terms:
- wordpress get thumbnail of first image
- call first image as thumbnail wordpress manually
- wordpress first image as thumbnail
- wordpress get first image url
- wordpress get first image description
- wordpress first image in caegory
- wordpress first image as thumbnail automatically
- wordpress codex first image of extract
- php get first post image wordpress
- google extracting the first image
- get_first_image wordpress
- get the first image in post wordpress wp_get_attachment_thumb_url
- get the first attach image using post id wordpress
- get post image by post id in wordpress
- get first image from wordpress post for thumbnail
- get first image attachment wordpress
- add first image in post as thumbnail wordpress






Hi it is great function to get first image from post but please tell me how can i resize first image with timthumb.php and i want different sizes in one loop for lightbox and post thumbnail
Thanks for this post, i’m unable to get it working though. After trying several tutorials on using the first post image for thumbnail. This one just doesn’t display anything at all, no errors, but no image.
I added the line to the loop, no idea why it’s not showing anything though >.<
I’m unable to get this to display the thumbnail at all, I’m sure I’ve added it properly. I’ve added thumbnail support and after doing that it displays the same image on every post. Any suggestions?
that is depends on which wordpress theme you are using. you just need to add the code in index.php file and functions.php file.
Awesome post. I so good to see someone taking the time to share this information