Display Thumbnails For Excerpts On Homepage In WordPress Without Using Custom Fields.

Many bloggers are preferring excerpts to be shown on their homepages, but the problem is that you have to explicitly give the meta data in the custom field of the wordpress editor, for displaying the images on the homepage along with the excerpts, But the problem is with old blogs, where bloggers have not mentioned the meta-data and the process of giving the path for each post, is a very lengthy process now.

Here’s how you can display the first image inside your post, in the homepage beside the excerpt more easily, using the first image within the post.

1. Download the Thumbnail for Excerpts WordPress Plugin.
2. Unpack and Upload the ‘thumbnailforexcerpts’ directory to the ‘wp-content/plugins’ directory on your WordPress plugins directory.
4. Activate plugin.

thumbnail-for-excerpt

Thumbnail For Excerpts searches the post for the first image. If exists, than it will search for the thumbnail created by default by WordPress for the image, if it was uploaded from WP administration area. If not, it will show the scaled image.

You can as well customize the plugin, by editing the values in the plugin file.

  • “TFE_ALIGN”,”left|right” :  Image alignment
  • “TFE_SIZE”,”100″ :  The size of the thumbnail; if you set to 0 it will be the default size of your WP thumbnails, from admin area.
  • “TFE_MAXSIZE”,”yes|no” :  If yes, than the above indicated size will be used as maximum size for width and height; if no, than the above indicated size is used only to limit the width.
  • “TFE_SPACE”,”5″ :   HSPACE parameter of the IMG tag
  • “TFE_LINK”,”yes|no” :   if yes, the image will link to the post
  • “TFE_CLASS”,”imgtfe” :  the class for the thumbnail images; you can change it or use this class in you CSS file
  • “TFE_CREATETH”,”yes|no” : if yes, the images without thumbnails will have one created now (based on default values for thumbnail from admin area, or on TFE_SIZE if in admin area thumbnail size is set to zero
  • “TFE_TITLE”,”no|yes” If yes, it will use titles for pictures
Similar Post  How To Check What's Causing The Loads On Your WordPress Blog

You can find this plugin in action in the Homepage of this blog.

Thumbnail For Excerpt  :   Homepage ||  WP Plugin Directory ||  Download

30 comments

  1. Tom Reply

    Hi there, thank you very much for this post – very useful.

    One question, How might i add padding to the thumbnail image in the excerpt version of the post? It is aligned left but the post text is touching the edge of the image and i want a nice gap between the two – this is blatantly a n00b question but i would love some help regardless 🙂

    Many thanks

    • Avinash Post authorReply

      @Tom : You can try to set the “TFE_SPACE” value in the plugin file which is the HSPACE parameter for the image.

  2. Tom Reply

    Solved my orn problem by reading the readme – and learning how to create a new class in the CSS

    for anyone as noob as me – just create something like this in your css file

    .imgtfe {
    background:url(images/content.png) top left repeat;
    margin: 0px 8px 0px 0px;
    padding: 5px;
    border: 1px solid #E6E6E6;
    }

    then edit at will
    – that code gives the image a background (change link to suit),
    – it sets the text 8px to the right of the thumbnail
    – gives 5px of padding around the
    – 1px border

    You wont want all of that, or you might, but its better to have more and takeaway than be stuck with nothing.

    Hope it helps someone and thanks again for the post and plugin!

  3. Tom Reply

    Thanks avinash – Your advice may be correct but i’m happy with using CSS now i have it figured out.

    Cheers though!

  4. Alex G Reply

    Hi Avinash,

    Great plugin, thanks very much. I am having one problem: if my thumbnail size is set in the admin area to something of unequal dimensions – like 200 x 100 – then the excerpts don’t generate correctly. The image width is set correctly, but not the height.

    I did reset TFE_SIZE to 0 but this doesn’t seem to help. Any ideas? Hope it’s not something I’m doing wrong!

  5. Cheese Reply

    Is it possible to display the thumbnail image below the excerpt text? In the plugin code I changed
    return $img.$excerpt;
    to
    return $excerpt.$img;
    but it makes no difference.

    Any help appreciated. Thanks!

  6. Cheese Reply

    Just looked at the code again and it seems return $img.$excerpt; only returns the excerpt text. $img doesnt do anything and is never initialised. If you want the image below the excerpt you have to echo $excerpt at the top of the function and then let the function output the image as normal. $img does nothing.

  7. slogans Reply

    Hi, thanks for the post, I am trying to modify this plugin to work on my slogans blog. I have it working but I want to move the thumbnail so that it is displayed the slogan (which is the post title) any idea how I might do this? Anyway, thanks again for the helpful post!

  8. modeca Reply

    Thanks for this plugin. It really helped me out. I was using a similar plug-in called Get The Image but for some reason it was working – but yours did the trick!

  9. rivermaya Reply

    Hi, I’m having trouble with thumbnail images at excerpt, I’m using Serene theme from Studiopress, the padding at aligment is fine, but the images catch the latest post images and appears all on homepage with the same images, the default image doesn’t work and if the post has a thumbnail by itself it double with image from the plugin.
    what should I fix ? thanks

  10. Pit Reply

    Thanks you for this article, I have been trying to get the excerpt with a picture in my website and I could not figure it out.

  11. Kalengirl Reply

    great plugin, I was looking for something like that a long time ago! the only thing I trying to change is to have a “read more” link at the end of the except post

  12. martin Reply

    thanks mate it works perfectly in my case coz i was using Paglines free theme and unable to see thumbnails on front page

  13. Josh Miller Reply

    Hey, can this be set to only act on a specific category. Example, if I have text posts I want to show up in full but other image heavy posts I want to be excert w/ thumbnails.

  14. Ivan Mugabi Reply

    Wonderful, Used it and it worked well for me! Thanks for the open source!

  15. Waren Reply

    Hi, it doesn’t work to my site. I already install the plugin and activate. But there is nothing? what is the next step to do after I activate the plugin?

  16. Bella Reply

    Hi there, thanks for sharing this plugin. This works perfectly on my site however the Read More does not show up below the excerpt 🙁 Can you please teach how to show the Read more? Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.