New in WordPress 2.9: Post Thumbnail Images

Many WordPress themes, especially those with “magazine-like” layouts, use an image to represent each post. It might just be on the front page. It might be alone, or alongside an excerpt. Until now, there was no standardized way to do this. Many themes would require you to tediously enter a Custom Field with the value being the URL you wanted to use. Often you had to do cropping yourself. With WordPress 2.9, theme authors can easily enable Post Thumbnail selection UI and call those image using simple template tags.

First, in the theme’s functions.php, declare that your theme supports this feature. This will enable the UI in the WP Admin.

add_theme_support( 'post-thumbnails' );

That will enable Post Thumbnail UI for both Post and Page content types. If you’d only like to add it to one, you can do it like this:

add_theme_support( 'post-thumbnails', array( 'post' ) ); // Add it for posts
add_theme_support( 'post-thumbnails', array( 'page' ) ); // Add it for pages

Simply remove the one you don’t want to support.

Next, you should specify the dimensions of your post thumbnails. You have two options here: box-resizing and hard-cropping. Box resizing shrinks an image proportionally (that is, without distorting it), until it fits inside the “box” you’ve specified with your width and height parameters. For example, a 100×50 image in a 50×50 box would be resized to 50×25. The benefit here is that the entire image shows. The downside is that the image produced isn’t always the same size. Sometimes it will be width-limited, and sometimes it will be height-limited. If you’d like to limit images to a certain width, but don’t care how tall they are, you can specify your width and then specify a height of 9999 or something ridiculously large that will never be hit.

set_post_thumbnail_size( 50, 50 ); // 50 pixels wide by 50 pixels tall, box resize mode

Your second option is hard-cropping. In this mode, the image is cropped to match the target aspect ratio, and is then shrunk to fit in the specified dimensions exactly. The benefit is that you get what you ask for. If you ask for a 50×50 thumbnail, you get a 50×50 thumbnail. The downside is that your image will be cropped (either from the sides, or from the top and bottom) to fit the target aspect ratio, and that part of the image won’t show up in the thumbnail.

set_post_thumbnail_size( 50, 50, true ); // 50 pixels wide by 50 pixels tall, hard crop mode

Now, you can make use of the template functions to display these images in the theme. These functions should be used in the loop.

has_post_thumbnail() returns true/false and indicates whether the current post has a manually-chosen Post Thumbnail (in the loop):

<?php
if ( has_post_thumbnail() ) {
	// the current post has a thumbnail
} else {
	// the current post lacks a thumbnail
}
?>

the_post_thumbnail() outputs the Post Thumbnail, if it exists (in the loop):

<?php the_post_thumbnail(); ?>

Those are the basics. How about some advanced stuff?

What if you want to use a small 50×50 hard-cropped image for the home page, but want to use a 400 pixel-wide (unlimited height) image on the post’s permalink page? You’re in luck. You can specify additional custom sizes! Here’s the code:

functions.php

add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 50, 50, true ); // Normal post thumbnails
add_image_size( 'single-post-thumbnail', 400, 9999 ); // Permalink thumbnail size

home.php or index.php, depending on your theme structure (in the loop):

<?php the_post_thumbnail(); ?>

single.php (in the loop):

<?php the_post_thumbnail( 'single-post-thumbnail' ); ?>

That’s it! set_post_thumbnail_size() just calls add_image_size( 'post-thumbnail' ) — the default Post Thumbnail “handle.” But as you can see, you can add additional ones by calling add_image_size( $handle, $width, $height, {$hard_crop_switch} );, and then you use that new size by passing the handle to the_post_thumbnail( $handle );

If you want your theme to support earlier versions of WordPress, you’ll have to use function_exists() to keep from calling these new functions in those versions. I’ve omitted that code to keep these examples as simple as possible. Here would be the functions.php example with the wrapper code:

if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
	add_theme_support( 'post-thumbnails' );
	set_post_thumbnail_size( 50, 50, true ); // Normal post thumbnails
	add_image_size( 'single-post-thumbnail', 400, 9999 ); // Permalink thumbnail size
}

There is one caveat for this feature in WordPress 2.9 — it only works fully for new image uploads. We can’t yet resize images on the fly, although I’m strongly considering it for a future version. If you call the template functions on a post that has a Post Thumbnail that was uploaded prior to your theme having declared the new sizes, you won’t be able to do hard-cropping, and the box-resize will be done in the browser. As a temporary solution, Viper007Bond has a great plugin that will go back and create missing image sizes for you: Regenerate Thumbnails.

I’m looking forward to see what kinds of sites you can build with this feature!

715 thoughts on “New in WordPress 2.9: Post Thumbnail Images

    • Ali Lochhead says:

      Thanks so much for the write up. Please can you help answer the following? I’m using wordpress 3.0 with Arras 1.5 I would like to insert my featured image for each post as a 80×80 thumbnail on the left hand side next to the post’s title. Not in the blog header and not in the post content but where the title appears. I’ve spend all day searching forums, plugins etc and nothing I have tried has been successful. All help would be greatly appreciated. Many thanks, Ali.
      http://www.alilochhead.com

  1. So glad you did a simply worded step by step breakdown on how to incorporate this. Thanks so much for the information and your hard work to incorporate this feature in WP 2.9.

    It does seem a little clunky still in its interaction…maybe I missed it in some official WP promotion, why do we have to enable through the functiosn.php file? Why isn’t it just available automatically? Or would it be if the line was in the loop in the theme file?

    • We didn’t want people to be confused by a “Post Thumbnail” meta box that had no effect on their blog. By making it opt-in, it will only show up on themes that support it. It’s also not something I expect every theme to incorporate. It doesn’t make sense for all layouts (which is why it’s not in the Default theme — tried to fit it in, there, and it was kludgey).

    • Hmm. That definitely makes sense from that perspective.

      I know I had some problems figuring out how to earmark the thumb for the post. I found the little link nestled below the image sizes.

      I kind of expected the dialogue box to go away, but on a new upload you need to save changes…

      What was the decision about the UI here? Where to put the link – how to use the existing media upload but integrate this feature?

  2. Hi i have a question : i’m using this new feature and i set in function.php like example the size of image and the hard crop, but this one doesn’t work…

  3. Cracks says:

    I also had grief, and no success, using this method for the sizings Mark. Both single and normal thumbs would register and display, but not seemingly working off the size declarations inside functions.php. Is there a common conflict that we should look out for …?

    I eventually used the more force-feed method of declaring the sizes inline (directly in single.php and index.php), and it worked as expected.

    this worked for me …

    [single.php] the_post_thumbnail(array(500,300));
    [index.php] the_post_thumbnail(array(250,150));

    So I’m not sure what the problem is (although it’s most likely me). I tried everything including function and cache flushing.

    (I found this method c/o: http://www.kremalicious.com/2009/12/wordpress-post-thumbnails/)

  4. Hi, i am currently developping a plugin to aggregate rss and completly customize the dashboard. Images have a special place in that plugin.

    How this new features will/could change the way rss are generated by wp ?

    see screenshot of my not-yet-released plugin here :

    thanks for your answer

  5. I currently use a thumbnail plugin called:
    Simple Post Thumbnails

    It has an option for a default thumbnail (if one is not set).

    Is there a way to have a default thumbnail be displayed if one is not set with the WordPress 2.9: Post Thumbnail Images?

  6. pressword says:

    am I missing something or those are NOT thumbnails but Resized images…

    please advise,
    thanks

    I’m able to set images as thumbs when creating/editing posts,
    then I manage to display them on the sidebar,
    but when I right-click them to view the image, I see the full image, :(

    thanks

    • I have the same problem, but not for all images, just some. I’m trying to find a pattern, but I can’t see anything common about their aspects. I even tried downloading one of the images I had problems with, a jpg, make it a little bit smaller in gimp and save it in png without changing the aspect, and upload, but it still didn’t insert the 50×50 image, just the original.

      Any tips? I had this problem on 4 out of 10 images on the site I was testing.

      Here is an example of an images that wont scale

    • I think I found the pattern, the script creates thumbnails, but whenever the size of the created thumbnail is bigger than the original image, it simply uses the original image and resize it.

      I might be wrong, but that’s what I’ve seen happening.

  7. Hi Chas,

    you can put an default thumbnail for each post without a thumbnail image through the “has_post_thumbnail()” function described by Mark.

    You put “the_post_thumbnail();” in the if-Part and then hardcode the default thumbnail in the else-Part.

    Greetz
    Markus

    • iskolares says:

      do you have a sample code for this?

      Here is my problem: I am currently running wp-o-matic on a channel theme.. The theme can generate on my old posts where the images are hosted in my space…

      on the new posts which are scraped from rss feeds, i think the theme is not avail to generate the thumbs since the images are hosted somewhere else..

      here is the code on the index.php to display the thumb.

      ID, ‘thumbnail’, ‘alt=”‘ . $post->post_title . ‘”‘); ?>

      I am looking for a way to display a default thumb is the theme is not avail to generate a thumb and i want to try ur suggestion, just dont know how to code it..

      any help will do. thanks! ^_^

  8. Post thumbnails can be used to create automatic navigation of child pages, too.

    With a plugin ( http://www.wlindley.com/website/autonav/ ) you can display, for each child page of the current page, that page’s

    * Title
    * Post thumbnail
    * Manual excerpt (description, like “teaser text”)

    And that plugin will create various sized thumbnails. If you change from 150×130 to 200×150 in the admin screen once, all the navigation thumbnails on your entire site change automatically.

    Thanks to the WP team for the fantastic post thumbnail feature!

  9. Hi everyone,

    My name is Freddy and I’ve wasted nearly a month of my life on this place ;-) I found it after being recommended by a few friends who have been hanging out here for quite some time.

    I am a writer, graphics artist, photographer and just about anything else that comes up around the office. Aside from the above interests i’m really into scifi as I know that is so much more out there to be discovered, and a feeling that the universe is just teaming with life.

    Well, I hope that I get to know more people here, share some experience and start learning. Have a greay day!

  10. Awesome post!

    Apparently I need to spend more time rifling through WP core as I totally missed the set_post_thumbnail_size() function. That is a really handy addition to the system.

  11. Thanks for the pointer to Vipers plugin. I hadn’t taken notice until I came back to re-read your post for a project I’m working on at the moment.

    Thanks again :)

  12. spencerbeggs says:

    I can only get WordPress to display square thumbnails. It lets me do the image editing and saves in the right aspect ratio, but in the Edit Post page sidebar and live on my site it appears as a square thumbnail no matter what.

  13. Dude, this is awesome.

    I’ve been using TimThumb, which is great, but a lot of people using my themes have crappy hosting that causes TimThumb to break.

    Thanks so much for adding this!

    • geekgirl says:

      TOTALY! I’ve been googling/searching wordpress plugins database just to see if someone already made a plugin to do just that; thumbnail editing.

    • geekgirl says:

      nevermind, just realized its possible in 2.9.2
      just doesn’t delete the original thumbnail file
      for instance, if ur thumbnail is called:
      myimage-125×125.jpg
      and u edit the thumbnail, wp will create an updated copy with the changes u made, named like so:
      myimage-125×125-e8573489573.jpg

      and it does this for all other images if u chose the radio button to edit all image sizes (and not only the thumbnail).. a bit of a waste of space if u plan on editing a lot of image files soon after uploading them (as the originals will never be used).

  14. Not sure if there is an easier way but I had to figure out getting the thumbnails outside the loop and this is what I cam up with.


    $pages = get_pages(‘child_of=25&parent=25&sort_column=menu_order&sort_order=asc’);
    $count = 0;
    foreach($pages as $page) {
    $thumbID = get_post_meta($page->ID,’_thumbnail_id’,false);
    echo ” . $page->post_title . ”;
    echo ”;
    }

    Not sure if that code will display legibly. :(

    The trick is to find the meta_value stored under “_thumbnail_id”, which is an array, where ID stores the attachement ID, then you can grab the attachment using that ID and the wp_get_attachment_url() function.

    I will have to work on a simple function like get_post_thumb($ID) that should make that easier. But works for now.

  15. Let’s try that again. Part got chopped off:

    $pages = get_pages(‘child_of=25&parent=25&sort_column=menu_order&sort_order=asc’);
    $count = 0;
    foreach($pages as $page)
    {
    $thumbID = get_post_meta($page->ID,’_thumbnail_id’,false);
    echo ” . $page->post_title . ”;
    echo ”;
    }

    • I used this and got the original uploaded image… but when I used the following, I got the dimensions I was expecting:

      $thumb = get_post_meta($page->ID,'_thumbnail_id',false);
      $thumb = wp_get_attachment_image_src($thumb[0], 'post-thumbnail', false);
      $thumb = $thumb[0];
      echo $thumb;

    • So, Im trying to add the featured image URL and tried your suggestion above but no luck. I inserted…

      <link rel="image_src" href="”/>

      but it is showing up blank.. Can you point me in the right direction? Also – is there a way to do this outside of the loop, IE – in the head of the page?

    • curt19 says:

      @Mark
      are you defining $thumbID?
      you need to put the this line above your link:

      $thumbID = get_post_meta($post->ID,’_thumbnail_id’,false);

      that will work inside the loop for a post, if you’re outside the loop you just need to put the post id as the first argument.

  16. wow. at last it seems that i can get rid of the custom fields with image links in it :)

    great one!

    does anyone has this combined with NextGen gallery? It would be great to be able to pick a thumbnail from that gallery. (now only in core media library I can choose ‘Set as Thumbnail’)

  17. What if you want the thumbmnail to appear on the index.php but not on the single.php. I’ve implemented the code you’ve suggested within my functions file and within the loop of the index.pph file and it plonks a thumbnail on my main blog page which is what I’m after, but it also plonks the same thumbnail on the single blog post page – is there a way to disable this?

  18. I’m running into an issue with 2.9 trying to get the thumbnail piece working that when I specify the add_theme_support( ‘post-thumbnails’ ); the ability to see / select any photos through the add image or media library (either ones from before the change or after). If I comment out the line they still exist.

    Any suggestions?

  19. At first glance I thought this was going to make life much easier but I think it still needs some ironing out… Lets say I want the post image to be 630px wide on the single post and 200px wide on the index. If I upload a lovely crisp jpeg measuring 630px wide, on the single page the processed image(630 px wide not resized at all) looks very nasty and blurry. I understand that the main use of this is for thumbnails, but if it takes an image of the same size and renders it ugly as all hell I’m going to stick with timbthumb until this starts looking a little sharper.

    • Disregard that! This is what I get for working late I suppose… CSS was stretching the image, I take it all back. Post thumbnails are the way to go!

  20. Emi says:

    Hello,

    On our blogs that already have many posts that were made with earlier versions of WordPress, how do we make all those posts use an image that is associated with that post? This is so we wont have to manually and pick a thumbnail for each post, that would be extremely time consuming.

    Thank you!

  21. Chas says:

    I am having difficulty writing the HTML link code and having the thumbnail be a link to the post… Any suggestion with the code and making the thumbnail be a link to the post? Thanks.

  22. Been trying all day. Can’t, for the life of me, see the UI feature to add the thumbnail to the post.

    I’ve added the following to my themes functions.php file:

    Any help? I’m running 2.9.1

    Could someone possibly post/link to a screen shot of it working in their build?

    Thanks,

    • Remove lines 4 and 5. You’re adding support for both, then just for posts, then just for pages (so now posts don’t have it). Just do it like in line 3 and it adds it for both. If you want to specify, pass in an array with all the ones you’re supporting it for.

  23. I added the code in my theme, but now I get this error:

    Warning: Cannot modify header information – headers already sent by (output started at /nfs/c04/h03/mnt/64590/domains/albotas.com/html/wp-content/themes/atahualpa344/functions.php:3) in /nfs/c04/h03/mnt/64590/domains/albotas.com/html/wp-includes/pluggable.php on line 868

    What does this mean?

  24. On my sites, when the thumbnail settings are different from the ones in the admin (media), they are not taken into account. Is it a bug or a feature ?

  25. So here’s a little issue I found. Hopefully I can explain it in a way that makes sense.

    If I go to an old post and click on the “set thumbnail” link, and then go to my gallery to choose a photo that I have already uploaded for that post. Then when it creates the icon it scales it down to fit within the 100×100 parameters. But in my functions file I am telling it to hard code it and crop the image to exactly 100×100 pixels.

    But if I take that same image, drag it to my desktop, re-upload it and choose “Set as thumbnail” then it will work for me. Is this some small glitch in WordPress?

    Thanks.

    • It only does hard crops for newly-uploaded images. That will likely be remedied in a future WordPress version (or you can use a plugin to go back and re-render the crops).

  26. Is it possible to remove or re-position the post thumbnail image that gets automatically added to the bottom of each post? I want to it show at the top of the post’s content, not below.

    I can do this manually, but there’s still that thumbnail image at the bottom that gets automatically added in when using post-thumbnails.

  27. iskolares says:

    reposting…

    Here is my problem: I am currently running wp-o-matic on a channel theme.. The theme can generate on my old posts where the images are hosted in my space…

    on the new posts which are scraped from rss feeds, i think the theme is not avail to generate the thumbs since the images are hosted somewhere else..

    here is the code on the index.php to display the thumb.

    ID, ‘thumbnail’, ‘alt=”‘ . $post->post_title . ‘”‘); ?>

    I am looking for a way to display a default thumb is the theme is not avail to generate a thumb and i want to try ur suggestion, just dont know how to code it..

    any help will do. thanks! ^_^

  28. Erin says:

    I was having problems with it displaying as a permalink and setting features such as title, class and alt. And in specific, setting the tile to the_title_attribute. Is there an easy solution?

    Many thanks.

    • Erin says:

      @Fairweb – thanks.

      Here is an update of what I have found. If you go to http://www.kremalicious.com/2009/12/wordpress-post-thumbnails/ it tells you that you can add a class, title and alt attribute.

      However, I haven’t been able to get the class variable to work. I tried combining Mark’s with the class variable in this way:
      the_post_thumbnail(‘single-post-thumbnail’, array(‘class’ => ‘pic fl’ ));
      With no success. And I tried changing the CSS from .pic.fl img to .pic .fl with no success.

      The only way I seem to be able to include everything is to:
      <a href="” rel=”bookmark” title=”Permanent Link to “> $the_title_attribute )); ?>
      But I thought the post thumbnail attribute would eliminate the need for all this. Btw, the array title attribute doesn’t work but it needs to be there for the a title attribute to work. Weird.

    • Erin says:

      Sorry all my code didn’t display.

      Basically I added div tags to add the class function, the link tag to assign the href to the permalink, title to the_title attribute and call the_post_thumbnail.

      But I am hoping someone knows of an easier solution.

  29. @Erin, my plugin does not do anymore than the core function appart from the fact that it takes the image source in different places. I’m sure the title attributes works, class works but not alt. Permalink do not seem to exist in the core function (I’d like it to).

    I’ll check on my plugin if it can be better. If you have any suggestion on it, please leave a comment on the plugin page.

  30. Thanks for the great write up! I’m super geeked about this new functionality, but seem to be hitting a roadblock. It seems as though it should be easy enough to get the caption/link/etc associated to the thumbnail, but I just can’t find *anything* on the web about how to go about doing this. I just need to be patient I suppose, with this being so new and the documentation not even being complete yet. Thanks again for the great article!

    • Erin says:

      I’m not sure what you’re asking but if sounds like the post thumbnail is not being associated with the post. Check that you are putting it inside the loop.

      If you’re trying to add the permalink then see my comment above. I’ve had to write it in a similar way to how you would call a theme integrated hack.

  31. Hi there, this is a great feature, and one that has a great deal of potential. If I can offer a suggestion:

    The images in my blog are all watermarked, and have a border around them. Cropping them to a fixed size will create an odd looking thumbnail. So my suggestion is to allow the image to be cropped *before* resizing, so that a border and/or watermark can be removed from the image before it is resized for the thumbnail.

    …Mike

  32. Thanks Mark, great post – had thumnails working in no time :)

    … but… I was excited about using this feature in my new theme, but I have run into a problem in that the hard crop function crops from top & bottom, or from sides.

    It would be so fantastic if, in future versions, you could select the crops for thumbnails (a la facebook profil pics for example) or at least select to crop from top left, or crop from center, or crop from bottom right etc…

    Do you think the functionality is likely to be extended to offer us more control over the cropping of thumbnails?

    • that’s a really helpful feature and I would love to use it.

      However, like Frank Prendergast and boylogik stated before, it would be really great to have options from where to crop.

      Is there some hope for a feature like that in the near future?

  33. Thanks Mark, great stuff here. I have a few questions if you have the time.

    Is it possible to add more than one of the post thumbnail boxes to the editor screen?

    Can the location it appear in be modified?

    Can the title given the box be changed?

    Can a paragraph of text be added to give instruction on its usage? (below the box for example)

    I want to use this for an attorney website project I am working on- the image will be used as the various attorneys profile pics on their profile page. These attorneys are most definitely NOT confident around websites and I need to make it as easy for them to use as possible.

    Being able to change the location and title of the post thumbnail box and add some instructive text would go a long way to making this easier for them. I am used to working with metaboxes (which of course allow me to easily do all of the above) But I am not sure how to achieve similar results with this post-thumbnail-box.

    I appreciate you may not have time to answer in detail, but if you could point me to some documentation (couldn’t find anything in the codex) it would be helpful.

    Many thanks!

    Ash

  34. Pingback: T. Longren
  35. David H says:

    Today is my birthday and what I’d really like is to understand custom fields. Some say it’s easy and some say otherwise. I tried following your post, but I’m still not clear. Can you point me to an easy to understand beginner’s tutorial? Is there a definitive source for custom fields? I’ve search with Google and read post after post and WP’s own codex, but still need more. Thanks!

    • happy birthday :D you can fill a custom field when you write a new post. and when you want to display this entry (in the code of you theme) you can use this field to display this post different or do something else. its easy if you understand it :D

  36. Tracy says:

    Hi,
    Thanks for the great tutorial! I’m having a problem though and was hoping someone may have the answer! I have followed Mark’s directions to the letter and everything works fine except it will not hard crop. Yes, I know the image has to be newly uploaded, and I have tried a million test posts with different images, but works great, except for hard crop, any suggestions?
    Thanks!

  37. Thank you very much. I have been developing a site for a couple of months, got stuck on thumbnails (didn’t want to use a plugin), went on holiday for six weeks, came back and gosh darn it you went and included the functionality in the core! Much needed and much appreciated – thanks!

  38. In my opinion, the 2 most important questions for developers are:

    1) If you define multiple handles (say 10 different image sizes) in functions.php, does wordpress generate all 10 sizes upon upload even though you may only use only 3 or 4 of the handles for that post within your theme? If so, that will slow down processing time and makes for a giant increase in files / storage. So DOES WP GENERATE ALL 10? or only when that post is utilized within the theme? How do I check this?

    2) Hard crop doesn’t seem to work. And as stated above, it would be ideal to specify from what point to crop (i.e., from top left, or crop from center, or crop from bottom right etc)

    Anyone know the answers? Thanks in advance guys / gals.

  39. brianmacdonald says:

    I’m not a coder, so I may be way out of line asking about this, but I can’t wrap my head around the thumbnails code. I used the “Regenerate Thumbnails” plugin to get the size I wanted, but I’m not sure exactly what code to paste in functions.php or where to put it. I have the custom field in my UI, but I thought WordPress was now generating thumbnails automatically.

    Something’s supposed to go in the loop, but I’m not sure what that means either.

  40. Thanks for the great tutorial! It was the perfect introduction to the_post_thumbnail.
    I implemented on a theme of mine, and I am now facing a small issue:I would like to display the caption of the image below it. Is there an array to call the caption when calling the_post_thumbnail?

    • The image is stored as it’s own post in the WordPress database and the caption is stored in the post excerpt. To pull the caption with the thumbnail give this a try:


      post_excerpt; ?>

    • ?php the_post_thumbnail();
      echo get_post(get_post_thumbnail_id())->post_excerpt; ?

      Be sure to add in the GT and LT sign’s, I had to remove them to display code here

  41. C. Spencer Beggs says:

    I can re-crop the thumbnail in the image editor and it displays the right way in the media gallery, however, when I select “Use as thumbnail” the image added to the thumbnail — both in the Edit Post panel and live on the site — is the thumbnail as it was originally generated. Regenerating the thumbnails with the plugin doesn’t seem to help. Oddly, everything works fine for cropping regular-sized photos.

  42. Davit says:

    Prior to stumbling on this article, I wrote my own meta box for post thumbnailing. It shows default thumb in the meta box, then when you click on it, brings up media library window where you can choose actual image, then when thickbox closes it substitutes default image in meta box with one that has been chose.

    After I found out that there is default feature for this in wp 2.9, I though woa, what a waste (my job that is), but then when I activated it and looked at new default meta box, first thing that came to my mind was – maybe it’s broken? What’s the point of a link in metabox just bringing up media library window and then inserting thumb not in a hidden field or something, but into the editor? What if I do not want a thumb do be there, should I delete it manually? And why it is not shown in the meta box itself?

    Or maybe, it’s just broken in my case?..

  43. Thanks for the clearly written, step-by-step instructions for those of us who break our blogs nearly every time we try to follow instructions written for professional coders. This worked the very first time, and that never happens!

  44. Chris says:

    Omg! I spent three months learning WordPress and its implementation of OOP from the ground up and pulled my hair out trying to get images working properly. Then this comes along, just as I finish my project!

    My next project is coming along nicely, and I’ve managed to very easily slot the functions into the main funciton file and the theme function file.

    You’re a hero mate.

  45. Thanks Mark … I have been trying to figure out what should I do for displaying all the blog post images as thumbnail if I want to redesign … You save my day

  46. Eric S says:

    Is there some kind of magical mystery I am not getting on using the POST THUMBNAIL to actually link to a bigger image of itself, and/or the actual post?

    I hacked at the code in my ARCHIVE and INDEX and wrapped an ANCHOR with the permalink tags and now when I click on the thumbnail it takes me to each post.

    But I want the singlepost page to, when clicked on, open the full-sized image. Is this possible? How?!

    PLEASE?! ;) This seems like it would be a given, but sheesh I am going crazy here.

  47. Eric S says:

    By the way, what I did that worked for linking the image to the post is as follows:


    <a href=""> "alignleft post_thumbnail")); } ?>

  48. Eric S says:

    Are you clicking the USE AS THUMBNAIL link on the post thumbnail image upload option?

    Do you have the function.php file updated?

    What version of WP are you using?

  49. I use WP 2.9.1, and I updated function.php in my theme like the instructions. The USE AS THUMBNAIL button isn’t load in my Post Thumbnail facilities, I don’t see it in “From URL” tab. What’s happened? It’s only load in “Media” tab, not in “From URL” tab.

    Can I use an external image url as my post thumbnail without upload it into my server? I use free image hosting such as Photobucket etc. to host my images.

  50. Eric S says:

    When you go into a post, on the far right side near bottom, is the POST THUMBNAIL widget there?

    WHen you are into that item, you can use GALLERY, UPLOAD, MEDIA LIBRARY and FROM URL

  51. Yes, I know it, I must use Set Thumbnail through POST THUMBNAIL widget, right?

    If we wanna choose an image as thumbnail, we click on USE AS THUMBNAIL option, right?
    The problem is: I couldn’t find USE AS THUMBNAIL option at FROM URL tab, I only found it at MEDIA LIBRARY tab. So, I can’t use an external image url as post thumbnail.
    Do you understand my problem?

    Can I use an external image url (FROM URL tab) instead of MEDIA LIBRARY as my post thumbnail? I need that condition because I use external image hosting like Photobucket.

  52. Eric S says:

    Yeah, ok, just did a walkthrough.
    Same here, the option only shows up for USE AS THUMBNAIL on the FROM COMPUTER and MEDIA LIBRARY, not the USE URL

    Why don’t you do a local save of the images you need to use for the thumbnail. That is the only thing I can think of right off.

  53. Great new feature for 2.9 Mark :) In 2.8 we’d needed a secondary thumbnail size with the ability to auto generate if not existing, and fall back to a default img if there was no attachment associated with the post at all. I called them post toenails and used the intermediate_image_sizes filter and some fresh code to put it all together.

    Looking forward to plugging this new stuff in and taking it for a spin :)

  54. Eric S says:

    Yeah the POST THUMBNAIL is pretty good, I am just at a loss why you cannot easily make a link to the post or image itself.
    I figured out the link to the post, but not sure why cannot get the file.

    I think the images adding height and width to the end is messing up my “trial” at this.

  55. Hmm…
    I use limited server space, so I need to use a minimal amount of filesize in my server.
    Do you know what the best way to compress an image without loosing too much image quality? I converts my pictures from *.jpg and *.png into *.gif but it’s not too significant.
    – If I use MediaLibrary, the function.php is converts the image with resize or crop? How each way works?
    – How about if I upload a an image that has width-height below the minimal width-height in function.php? What’s the consequences?

  56. Eric S says:

    I personally prefer to use jpeg for pics and png for graphics. I just adjust my slider in Photoshop when saving but usually try for around 70%-60%

    check out the post thumbnail template file in the wp-includes for some of the info. But I think up there is some info on hard cropping and such with the images.

    • Eric S. says:

      I hear ya Mossack! ;)
      I am new to WP but not programming and web, so this is a learning thing for me too.
      The postthumbnailtemplate php file should/might have that info.
      I am trying to get the thumbnail function to not throw that sizing tag on the end. I think that is why I cannot get the image to link itself to a bigger size image

    • I upload my thumbnail that has 300x275px size. So the resize/crop function isn’t do anything to that image. See at my http://www.mossackanme.web.id/tutorial/ and do right-click on my headline thumbnail, the image URL should the image itself (not followed by the cropped size).

      Another idea : How can I make Featured post list as slideshow like Arthemia Premium? I have more than 4 Featured post, but only 4 of them is diplayed on my homepage.

    • Eric S. says:

      It does not look like you have the jQuery carousel running? Are you using the same exact featured effect?
      On the Arthemia theme it has a jQUery carousel and it has the function called in the code too. I don’t see it on yours right off?

      For the Post Thumbnail cropping, do you have the one simple theme support call in your function.php file?
      That is all I had to do and it does the cropping

    • I wanna integrate it into my wp, but not yet success.. ^^ Any simpler way?
      I don’t see any “carousel” in my Arthemia Free, but integrate it from Arthemia Premium to the free one is seems difficult…

    • Eric S. says:

      I do see on the theme itself the items are set up in an unordered list and your items are not in an ul with

      applied to it?

    • Hmm…need an emergency help…
      Please see my http://www.mossackanme.web.id/tutorial/
      My blog title is same at every pages! Whoaaa…
      I don’t know what’s happened…
      Can you help me?
      I’ve added some code to show 5 colorfull category on the sidebar like ArthemiaPremium. Send me a blank e-mail to mossack [dot] anme [at] gmail [dot] com and I’ll send you my sidebar.php.

  57. <div style="background:url('
    ID, ‘_thumbnail_id’);
    echo(wp_get_attachment_url($thumbid[0]))
    ?>
    ‘) top left no-repeat”>

    Works fine to insert post_thumbnails as backgrounds!!
    Thks by the post and comments by @Marty Thornley

  58. cary says:

    I’m having the same problem as Tracy. Hard-cropping does not work for me – it just does the standard box-resize.

    Digging into the code, it doesn’t seem like there’s any place where any cropping is actually going on. I’d expect one of the functions to call image_resize() but I honestly do not see the code anywhere. From waht I can tell it just calls the intermediate resize function which basically box-resizes it.

    • Eric S says:

      Did you look in the post thumbnail template file? I have not looked at it yet, but just came across that file a week or so ago..may help, I dunno

  59. Mark: Are there any plans to implement a feature where you can choose multiple thumbnails for a post/page? I was hoping that was possible with this new feature, but it seems it’s not. I think it could be really useful on some themes. Thanks!

  60. Hi, I love your step-by-step directions. I just edited a blog for a client: http://bit.ly/cat2Ye (shortened the url) but the home page layout adjusted drastically to show only a snippet of each post and no image. How can I incorporate thumbnails (on a separate page – not the home page) AND keep my original layout?

    Please help :), high-traffic blog and now it’s stuck (I’m wary of deleting all my new code with hopes that I can ‘fix’ the issue to keep thumbnails too)

    Thanks!

  61. Hi Mark,

    Thanks for the detailed breakdown on th thumbnail function and feature now available in wordpress. I have added this all into a new theme I am working on and its working great… when I have selected a thumbnail in the post.

    I had some problems creating a default thumbnail to appear on the index when no thumbnail had been selected but got round this but for the life of me I cannot seem to make the default thumbnail link to the post title where it is being called.

    Building of this statement If –> Else I got an image to appear but cant get it to link to the post title. Anyone able to help at all? Here is the code I was messing with

    http://pastebin.com/f5b80d5e

  62. Hello, as you can see this is my first post here.
    Hope to receive some assistance from you if I will have some quesitons.
    Thanks in advance and good luck! :)

  63. Congratulations about your post, really.
    It is very detailed and about a new feature!
    Helped me a lot.

    I was just wondering if there is a way to configure that the default thumbnail of posts uses the thumb image of wordpress with default size. I believe WordPress will improve that if it isn`t already working that way :)

  64. Congratulations about your post, really.
    It is very detailed and about a new feature!
    Helped me a lot!

    I was just wondering if there is a way to configure that the default thumbnail of posts uses the thumb image of wordpress with default size. I believe WordPress will improve that if it isn`t already working that way :)

  65. Pingback: Adding Post Images
  66. Wow, it is about time they add this tag to wordpress. It is sooo useful. I have always used the custom fields to achieve the post thumbnail affect, I will for sure be using this one in my next project.

  67. veda says:

    “There is one caveat for this feature in WordPress 2.9 — it’s only works fully for new image uploads. We can’t yet resize images on the fly, although I’m strongly considering it for a future version”

    It would be great! actually I create a new website (available but not communicated). Visitor are able to create their own post (with TDO-mini form). I use theme similar to this one : http://www.studiopress.com/demo/lifestyle.html. It uses thumbnails for post in home page and big thumbnail for the “fetured content”. Actually i try with Post Thumb Revisited. It’s working but i take to much time to process (without it my home takes less than 1 sec to load, with it more than 4 sec.

    I fact on the fly it checks if the thumbnail already exists for the posts, if not it parses the posts for image or video and create the thumbnail on the fly or put the default image (normal or video default image).

    If it can be doned at core level with a lightweight manner it will be great. For now i cannot release my new website because it takes too much to load the page.

    Do you think Mark, this will be in the next release of WordPress (3.0) ?

    Regards, Joan.

    ps: TDO-mini-Form works too but too heavy (without it 27 SQL queries at home page, with : 838 SQL queries!! . It adds 4 sec on the home page load! even if TDO-mini form is only used in a dedicated page :(

  68. veda says:

    I need to do something like this:

    if ( has_post_thumbnail() ) {
    the_post_thumbnail();
    } else {
    $thumb = getFirstImagefromPostandResize ();
    set_post_thumbnail($thumb);
    the_post_thumbnail();
    }

    getFirstImagefromPostandResize it’s ok code already available based on plugin.

    I need to know how to do for this kind of function in wordpress : set_post_thumbnail($thumb)

    in order to store my automatically generated thumbnail

    and reuse it transparently with the_post_thumbnail() without passing by manual GUI uploader (set thumbnail);

    Do you know how to do it? which function i have to call in wordpress?

    thank you very much for your answers.

  69. veda says:

    I need to do something like this:

    if ( has_post_thumbnail() ) {
    the_post_thumbnail();
    } else {
    $thumb = getFirstImagefromPostandResize ();
    set_post_thumbnail($thumb);
    the_post_thumbnail();
    }

    getFirstImagefromPostandResize it’s ok code already available based on plugin.

    I need to know how to do for this kind of function in wordpress : set_post_thumbnail($thumb)

    in order to store my automatically generated thumbnail

    and reuse it transparently with the_post_thumbnail() without passing by manual GUI uploader (set thumbnail);

    Do you know how to do it? which function i have to call in wordpress?

    thank you very much for your answers.

  70. Arun says:

    Does this tag only work with images that are uploaded using the built-in media uploader? What if the images are uploaded via FTP to a folder on the same server, but outside of wp-content?

  71. To show thumbnail or medium images just I’ve made my own query based on get_posts($args) and wp_get_attachment_image()

    The code:

    $image_post = array (
    ‘post_type’ => ‘attachment’,
    ‘numberposts’ => 1,
    ‘post_status’ => null,
    ‘orderby’ => ‘ID’,
    ‘order’ => ‘ASC’,
    ‘post_parent’ => $post->ID );
    $attachments = get_posts ( $image_post );

    if ($attachments) {
    foreach ( $attachments as $attachment ) {
    $img = wp_get_attachment_image ( $attachment->ID, $size = ‘thumbnail’, $icon = false );
    echo $img;
    }
    }

    Example: http://www.recetaecuatoriana

    Daniel

  72. I too can show the “re-sized” images but it should be pointed out that these are merely the original image (re-sized in dimensions, not file size) which retains the original file size.

    If you have a page full of these “thumbnails” then you are loading a lot of data.

    Shouldn’t you include some sort of phpThumbs image re-sampling etc based on something such as the php DG library?

  73. Hi everybody !
    I was trying to show thumbnails in my post excerpts.
    I’m trying to get the easiest and more authomatic way for showing them.
    This is my plan: to show a thumbnail with the same name as the post id + jpg (or gif or so on).
    Does anybody know what should I do for getting it?

    Thanks a lot in advance !

    • Eric S says:

      The featured section on the NewWPThemes are actually done by going into the Themes Option under APPEARANCE and then clicking and choosing the category you want to use.

      The function sets up temporary images in a folder in JDGALLERY in the slides images folder. But change the category from SELECT to a category and it will be setup

  74. kwaku says:

    hey I can’t add this new feature on wordpress sites hosted on windows server 2003, iis6, php 5.3.2, wordpress 2.9.1. I get no thumbnail UI on post editor page and if I use “the_post_thumbnail();” function i get errors. I successfully use the same code and themes on a linux server. Any ideas why this may be.

  75. Hi. Thanks for the walkthrough (and allllll of your contributions!).

    I am trying to use this method to add a thumbnail, but when clicked, I want to use the “rel=”lightbox” to evoke the lightbox plugin for the larger version (say the single page sized-version). In order to do that, I must link to the image.

    I have tried adding something like

    <a href="” rel=”lightbox”>

    but of course the_post_thumbnail( ‘single-post-thumbnail’ ) includes much more than just the image name.

    Please help.

    • Troy, did you ever get an answer to this -or- figure it out? I would like to do the same exact thing. I would appreciate any guidance.

      Thanks

  76. Angel says:

    I am having a problem getting the thumbnail to show in my child theme “Gallery.” Here is the string I have in the functions.php file to have my thumbnails show on the home page.

    here is a link to the demo site: http://www.reinnovating.com/yourbusiness/

    I’ve also tried {the_post_thumbnail();} instead of {get_the_post_thumbnail();} and cannot get the thumbnails to show

    Any ideas?

  77. I’ve used this feature to make a custom template for a failblog. Implemented for both images and videos extensively. Site can be found at http://www.failorfunny.com

    However, I used the default thumbnail sizing technique rather than hardcoding it. Thing is, I made that theme when WP2.9 just came out. I wish this post was out earlier. Defining multiple thumbnail attributes is just so much easier!

  78. Hi,
    I have followed your tut but am still having trouble!?
    This is my code: functions.php
    add_theme_support(‘post-thumbnails’);
    set_post_thumbnail_size( 564, 206, true );
    index.php:
    ‘alignleft’ )); ?>

    But..the image still does not take on these dimensions? I think the image is keeping in proportian..?
    It is 206px high but does not stretch to 564px wide?
    Please help.
    PS The site is not live yet.

    Thanks

  79. Eric S. says:

    I have not been able to play with the code lately, but was wondering:

    Does anyone know how to make the THUMBNAIL a link to the full size image and not just the post?
    I have the thumbnail setup to link to the post on most pages, but on the actual singlepost I just want to have the image linked to a full size image.

  80. Wow- thats a lot of comments!

    Thanks for creating this guide dood – its really helpful.

    Sooo much easyer to configure than a whole bunch of broken thumbnail plugins out there.

    Your explanations and language are easy to read. thanks :)

  81. Is anyone else as dumb as me and gets both the thumbnail and the fullsize image in the front page post and the single post?

    Help!!
    TIA

  82. Lee says:

    Will there be customized thumbnails cropping capability in the next update? I’ve resorted to regenerate my own thumbnails since currently the thumbnail generation seems to favor the middle part of an image. :)

  83. Hello everybody,

    I’m originally from the USA. and I am fresh inside this website.

    I’ve chozen the username morSoymbozy due to the fact it entails a letter from each particular person from my spouse and children,mother, father and brothers. As it is possible to see I have a rather big spouse and children whom I love most. I thank them everyday for putting up with me.

    My real name is Andrea, Nice to meet you all.

    Simply just popped in to say hello to everybody. This can be my 1st time here and I encounter it all as highly remarkable!!! I’m as new a newbie as they arrive about the world wide web but I’m so glad I found this website where I consider I can talk and study with other people right here during the community.

    I have three wonderful kids, two girls and a boy. The girls are both 9 and my boy is 12. I was blessed adequate to receive them with my partner whom I adore deeply.
    I am searching forward to seeing us all grow like a community and to become taking part as significantly and as fine as I individually can.

    Regards,

    morSoymbozy

  84. Wes says:

    I’m new to wordpress. Is there a way to search for themes that support this great feature? Excellent writeup by the way.

  85. Iv used the thumbnail function on a few sites and it works great. I’ve run into one issue though, well not really an issue. Let me explain.

    I’m using the thumbnail tag on an index page for two sections that use two different size images. One needs to have a specific size image and the set_post_thumbnail_size works for this, but it also re sizes the second thumbnail. Is there a way to decipher between the two sections?

    Thanks.

  86. MichaelC says:

    Since adding Thumbnail support my WordPress gives blank screen on saving of any post or theme editing.

    When I go back through from the dashboard, the changes are there – only for the problem to happen again on next edit.

    If I remove add_theme_support(‘post-thumbnails’); from functions.php the problem disappears.

    Please help!!

    Thanks,

    Michael

    • MichaelC says:

      Quick addition: WordPress continued to do the blank screen until I deleted the test page I had created with a thumbnail.

      Also – to make sure the problem wasn’t a conflict with a plugin, all had been deactivated.

      So what’s going on?

      I’m REALLY keen to use the feature – but I can’t when its like this.

      Thanks in advance,

      M

  87. Hello Everybody,

    I am new member right here

    I not long ago found this place and so far i have found lots of great info right here.
    I’m looking forward to connecting and contributing to the forum.

  88. hi anybody,

    I am new here within a forum. My actual name is Jeanine Dulore. It can be nice to meet you all. I’m a the mother of four children and better half to a fantastic partner Mike. I’m looking forward to take part in the forum.

    OptileFit

  89. Hi.

    I think that the thumbnail function is just great.
    I’m using it to show a thumbnail of the child pages on a parent page. It is a website with a lot of content and images.

    And my problem is:

    I have a problem showing the thumbnails of all the children pages on a parent page.

    From the page source I can see that the child pages are listed on the HTML, but for some reason there are always only 15 thumbnails per parent page, even though there are more children pages.

    And it’s always 15 thumbnails per page. Where I can change this? Is this somekind of a default?

    I’ve been struggling with this for a couple of days now. So help would be much appreciated!

  90. analogue40 says:

    Great tip, just used this for the featured posts section on my Chinesehacks.com website, very useful!

  91. Great post, thanks for you help! I’ve referred to your code about a dozen times for various projects in the last few weeks. Finally gotten around to documenting myself so I don’t have to keep coming back!

    One thought though – the example you use is a perfect square (50×50). For noobs it might be worth changing that to 50×75 so it’s easier to tell which is height and which is width in your examples.

    • True, but he does mention this…

      add_image_size( $handle, $width, $height, {$hard_crop_switch} );

      Which should tell even n00bs where to put their details :)

  92. I have it working…sorta. I’m totally stuck and there seems to be a lack of documentation on the Codex for this feature so here goes.

    The small 160×160 thumbnail for article listings/search views works fine. It crops it, all’s groovy. The issue comes when I go to format the image for the single.php article details view. It crops, but then scales down even further for some reason.

    Screenshot:

    NOTE: every time I re-test this I’m completely deleting the image from the media section and re-uploading the image entirely. I also have the re-create thumbnails plugin so I know it’s not caching.

    • I meant to include my code. This will help in debugging.

      add_theme_support( ‘post-thumbnails’ );
      set_post_thumbnail_size( 160, 160, true ); // Normal post thumbnails
      add_image_size( ‘single-post-thumbnail’, 618, 150, true ); // Permalink thumbnail size

  93. Will Ashworth says:

    Is there any way to access the path of one of these images instead of having it output an image tag? I need specifically the path itself…nothing more.

    We’re intending to pass it into flash via a flashvariable and need the path instead of the actual image tag. I could strip it out via strstr() but that’s messy and could break later with a WordPress core upgrade.

    Right now we’re using:

  94. Jimmy says:

    “What if you want to use a small 50×50 hard-cropped image for the home page, but want to use a 400 pixel-wide (unlimited height) image on the post’s permalink page? You’re in luck.”

    What happens if you want to use a different image for the thumbnail (a teaser so to speak) and then a different image for the permalink? Could you please tell me how to do it?

  95. Would anyone happen to know why I cant get this working for Page thumbnails? I’m trying to list child pages using this code. (the 2nd one, in ‘post format’). Switched out all instances of ‘content’ with ‘excerpt’ and used Andrew Oz’s Excerpt Editor which is seriously cool.

    When I try to plug in the code for the thumbnail, it doesn’t show.

    Any idea what I might be doing wrong?

  96. Did I thank you already for this excellent tutorial? After years of having to resize&upload every single pic featured on my main page I can finally do it the easy way. Thanks a lot!

  97. kiss – keep it simple and stupid

    i really like the way u explain everything in snippets!! So much more efficient than those markup’d and overdosed examples!!!

    I tried to change the media folder to “wp-content/uploads/%category%/%postname%/” like the post-permalink setting. What happend i got 2 folder with the names %category% and %postname%, is there a way to make this happen or will it be supported someday?

    Any idea why in the media library deleted images still are in the file system?

  98. Ray says:

    Great … I added your code into functions.php and it screwed up my wordpress editor and the function of my theme.

    • Will says:

      I’ve been having really good luck with it. What’s WordPress doing exactly on your install? Can you paste your code so we can see if maybe there’s a typo?

    • Ray, double check to see if there are any extra line spaces in the functions.php file where you pasted the code. That’ll throw double header errors. Take out the spaces and try again.

  99. Sam Johnson says:

    Wow what a thread!

    Okay I have been trying to figure this thing out with no luck. Here is my problem. I have an autoblog that uses wp robot plugin. The plugin post images, but does not save them to the server. Which I like because its one less image to host. However the problem that I am running into is that on magazine type themes; the thumbnails for amazon,articles,youtube,and yahoo answers do not show up on the front page or in the sliders of themes like solostreams wp clear or woo themes gazette or the arras theme.

    I have tried the get image plugin to no avail. is this possible to make this happen?

    Thanks

  100. Sam Johnson says:

    Will this work on an autoblog?

    The WP Robot plugin does not download the images to the server. So I am not sure how to make this work.

    Anyone use WP Robot?

  101. [...] tags. More information about how use post thumbnails and adjust their default sizes can be found at Mark Jaquith’s tutorial on the [...]

  102. Yahya Ayob says:

    Hey Mark, I’m very fond of using this support add-on. But I have a problem which you may like to help me out here.

    Currently, only Authors (user role) can upload new photos using the Post Thumbnail panel. As in this case, Authors can write posts and submit without moderation of the Admin when he/she publish it.

    However, I like to build a site with this scenario. A Contributor can write the post and at the same time use the Post Thumbnail panel (powerful thing) to upload new photos.

    He/she can then click the Submit For Review button for the Admin to moderate, approve and later publish the post.

    Currently, the problem is that Contributor could not make use of the Post Thumbnail panel.

    Is there a way to tweak this or allow Contributors to use this powerful feature?

    Look forward to your solution, Mark! Cheerz!

  103. Hi, Im using videoflick 2.2 theme and I uploaded the thumbnails normally using the simple thumbnail uploader on the home tab. They worked. Yesterday i lost my blog url address and got locked out of my own website thankfully managed to get it back and now the thumbnails are gone. Whenever I try to upload a thumbnail it refreshes and says ‘ Post Updated’ but the thumbnail doesn’t work. Any ideas?

  104. hey, I’m trying to get this new feature to work, and I can get it to display the images just fine, however I need to just get the URL as the image styling etc is handled somewhere else.

    I’m trying to get the Post Thumbnail to work with the YARPP plugin, and I need to be able to retrieve only the URL of the post thumbnail. I did see some code somewhere in this section on how to do it, but it’s giving me a complete headache!

    Any tips?

  105. Tatva168 says:

    Hi

    i have installed a wordpress component for joomla but when i try this feature i am not geeting any post thumbnail box on editor page in admin side

    i have tried by putting in /wp-content/themes/sk/functions.php
    if ( function_exists( ‘add_theme_support’ ) ) {
    add_theme_support( ‘post-thumbnails’ );
    }

    what will be reason? any one can help fast?

  106. hello
    i’m so happy that i found this site. that article was so great. thanks again i signed up to this website.
    are you planning to post similar articles?

  107. Thanks for the step-by-step tutorial. I haven’t altered my WordPress yet, but this feature is something i would really like to employ in my blog.

  108. The array($with,$height) did not work, it returns a square thumbnail. Added set_psot_thumbnail and add_image_size in funtions.php.. didn’t crop correctly, some thumbs were 135×80, while i want 186×80..
    I was forced to do it this way:
    the_post_thumbnail( ‘joint-thumbnail’, array(‘class’ => ‘alignleft post_thumbnail’, ’style’ => ‘width: 186px; height: 80px;’));
    The inline CSS was the only way, because CSS would not override the element style, IMG had a width and height attribute in html.

  109. Laura says:

    Hi, sorry if this has been asked before, but is there a way to not hard-code the thumbnail size values into the functions.php? What kind of code could be used for the thumbnail function to pull from the values in the WP media settings for thumbnails?

  110. This is an invaluable blog post. I am going to work through this over the next couple of days and set this knowledge in concrete somewhere.

    Thanks so much.

  111. Loving the thumbnail functionality. Anyone who needs to extract the thumbnail src URL during the loop (e.g. for CSS background images) can do so using:

    preg_match('/(src)="([^"]*)"/i', get_the_post_thumbnail( get_the_ID(), 'single-post-thumbnail' ), $matches);
    
    echo $matches[2];
    

    or try here if it doesn’t show right:

    http://paste.ly/1eq

    • Jeffrey van der heide says:

      Adapted Stephen’s code for use in a function, so that running multiple instances of it isn’t such a hassle…

      Paste this in to your theme’s functions.php:

      
      function thumbSrc( $t , $s )
      {
      	preg_match('/(src)="([^"]*)"/i', get_the_post_thumbnail($t , $s ), $matches);
      	return $matches[2];
      }
      
      

      and then call it like this:

      thumbSrc(ID,’size’);

      for instance when I was using it with the Gigpress plug-in:

      $agenda_post_id = $showdata['related_id'];
      thumbSrc($agenda_post_id, ‘thumbnail’)

      this method also allows you to get the larger one.. good for when you want to link to it or whatever..

      thumbSrc($agenda_post_id, ‘large’);

  112. Great feature, and excellent information here, thank you Mark! I have the same problem as MichaelC. Since enabling this, I get intermittent server 500 errors or blank pages when saving posts/pages. I can’t see a pattern to it. Any advice?

  113. Awesome stuff mark.. I had no clue about the new thumbnail feature in wordpress 2.9.2! You saved a lot of my time in converting images to thumbnails by coding it … :D Thanks for sharing the knowledge..

    • By the way, can you put more light on how can we modify the alternate text of the thumbnail at code level? By code level I mean not going to the backend and editing the alternate text of the original image :)

  114. Pingback: Reboot | Frozr.com
  115. Thanks for the information. Exactly what I was looking for. I really love the direction that WordPress is taking this. I’ve been duplicating these features using plugins every which way, but this is fantastic to have a way that is built right into the application.

    I wish there were more ways to customize the custom fields. I use Magic Fields (and previously Flutter) and I really love how it adds the UI for the different types of custom fields. This image upload is another great step in that direction.

  116. Thanks Mark,

    Don’t Tell xentek but i wanted to play with a different theme then k2. So im trying Thematic and there was no thumbnail support.

    Now there is ;c )

  117. Hello Mark,

    I tested your work and I see that You must not add the “add_theme_support()” for post and page in order to run good. I can provide extra code for example if needed..

  118. Andrei says:

    Also i observer that when i delete a picture it doesn’t delete the thumbs from server. And when many pictures are added and deleted lot of thumbs remain on server…

  119. Banik says:

    I followed your tutorial, and I got the thumbs and I want a custom size like w=180 h=115 but for some photos I get a square thumb like w=115 h=115, if I change the settings and put w=115 h =180 I still get a square thumb with w=115 h=115, seems to overwrite the bigger setting and make a square thumb, tried regenerating the thumbs and nothing worked
    Any help is appreciated

  120. In order to run good the thumb nail options i have this in my function.php or a plugin


    add_theme_support('post-thumbnails');
    set_post_thumbnail_size( 120, 80, true ); // 120 pixels wide by 80 pixels height, crop mode on
    add_image_size('single-post-thumbnail',200,100,true);

    add_action('delete_attachment','pa_delete_attachment');

    function pa_delete_attachment($postid) {
    global $wpdb;

    $path = wp_upload_dir();

    $rez = wp_get_attachment_metadata($postid);

    foreach($rez['sizes'] as $size)
    if(is_file($path['path']."/".$size['file']))
    unlink($path['path']."/".$size['file']);
    }

    And in the theme file i have like this
    if(has_post_thumbnail() :
    echo get_the_post_thumbnail(NULL,'post-thumbnail',array('class'=>'alignleft'));
    endif;

    I use the action on delete_attachment because i found out that wordpress doesn’t delete the custom thumb size like : single-post-thumbnail in my case..

  121. Amanda says:

    I’ve tried to implement this, but on the edit post page, when I click “Post Thumbnail”, the lightbox interface that pops up with the title “Add an image” is completely blank… Any ideas on whats wrong?

  122. Don’t know find anybody solution how to get thumbnail image url.

    Thats what i done and it works fine.
    Add to functions.php in theme folder:

    function thumbSrc( $t , $s )
    {
    $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($t), $s);
    return $thumbnail[0];
    }

    Then call it in template:
    ID,’thubnail’); ?> or ID); ?>

    I have set three sizes of image:

    add_theme_support( ‘post-thumbnails’, array( ‘post’ ) ); // Add it for posts
    set_post_thumbnail_size( 95, 9999 ); // 95 pixels wide by 9999 (no limit) pixels tall, box resize mode
    add_image_size( ‘middle-thumbnail’, 165, 9999 ); // Permalink thumbnail size
    add_image_size( ‘max-thumbnail’, 350, 9999 );

    Set the same sizes in admin panel Options->Medifiles

    Then I call them where i need it:

    ID,’thumbnail’); ?>
    ID,’medium’); ?>
    ID,’large’); ?>

    Same results for pair

    ID,’max-thumbnail’); ?>
    ID,’large’); ?>

    ID,’middle-thumbnail’); ?>
    ID,’medium’); ?>

    Sorry for my English :) Hope this will help somebody.

  123. Pingback: test
  124. To get just the src of the image instead of the full html output do the following. The function assumes that you are in the loop.


    function my_custom_post_image($post_id){
    if (has_post_thumbnail()){
    $thumbnail_id = get_post_thumbnail_id($post_id);
    $thumb = wp_get_attachment_image_src($thumbnail_id, array(793, 318));
    return $thumb[0];
    } else {
    return II_IMAGES . '/story.jpg';
    }
    }

    For more documentation see the Codex: http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src

  125. To get just the src of the image instead of the full html output do the following. The function assumes that you are in the loop.


    function my_custom_post_image($post_id){
    if (has_post_thumbnail()){
    $thumbnail_id = get_post_thumbnail_id($post_id);
    $thumb = wp_get_attachment_image_src($thumbnail_id, array(793, 318));
    return $thumb[0];
    } else {
    return 'path/to/default/image/blah.jpg';
    }
    }

    For more documentation see the Codex: http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src

  126. I wear an artificial StudioPress news wordpress theme using pictures with different hosting but do not work but I’ll try it this way, good luck thanks

  127. Thank you for this! I’ve been fussing with WordPress for weeks not trying to get a decent related posts plugin with thumbnail functionality to work and after finding this it now works. Thank you!!! :)

  128. I’ve looked around quite a bit an there doesn’t seem to be any way to make the thumbnail into a link, even in WordPress 3. Will this function be added in the future?

  129. soooooooo
    what happens if my theme does not have a ‘functions.php’ file…

    Can I just make one with this code above? How do you make sure its read by the rest of the theme?

    (I am in no way a web developer, just a designer trying to make things happen with my wordpressssssss)

    Thanks for your help.

  130. Love your post my friend…just started adding it to new themes I build for clients. Works like a charm and is a much better solution than using Custom Fields. Thanks for your time!

  131. I’m having trouble with thumbnails.

    I can’t seem to control them…
    where there is no add theme thumbnail function in my functions.php they are STILL displaying.

  132. stephen says:

    I’m trying to add a featured image to my post, but pressing “crop” does nothing. When I save the featured image, WP ignores my selection, auto-selecting a portion in the center of the image instead. Ideas?

  133. Pingback: Retired | scribu
  134. Kieron says:

    Hi Mark,

    I used a tutorial by one of the support staff on itunes to create a magazine style home.

    I am also going to use Remote Publishing on my site have have it all working to a point. I can create the posts automatically with the php i have wrote but i was wondering f you know if there is any way i can use XML-RPC publishing protocols to add a featured image/thumbnail to the post???

  135. Kieron says:

    Hi Mark,

    I used a tutorial by one of the support staff on itunes to create a magazine style home.

    I am also going to use Remote Publishing on my site have have it all working to a point. I can create the posts automatically with the php i have wrote but i was wondering f you know if there is any way i can use XML-RPC publishing protocols to add a featured image/thumbnail to the post??? cvdscvdf

  136. Kanttila says:

    Hi!

    Thanks for the great tutorial. I have everything up and running with WP 2.9.2. but it does not work at all with WP 3.0.. The theme works otherwise jsut fine. ALso when I am trying to add the thumbnails according to the tutoria to new theme running on WP 3.0 I have no luck.. The new theme on the other hand works like charm on 2.9.2.

    Any hints how to work this out? Thanks.

  137. Luigi Barbati says:

    Hi!
    nice tut, buti i have a question: there’s a way to change the name of the metabox, for example placing a “Thumbnail” instead of “featured image”?

    thanks for replies.

  138. redsocks says:

    What kind of shit is this? I pasted the code and, yes, now I have thumbnails in my excerpts… but all other post’s images are also shown as thumbnails! If you release some code, be sure it fucking works! What a crap and waste of time.

  139. sbteaches says:

    I get syntax error messages when I try to add this: has_post_thumbnail() returns true/false and indicates whether the current post has a manually-chosen Post Thumbnail (in the loop):

    1

    the_post_thumbnail() outputs the Post Thumbnail, if it exists (in the loop):

    1

    to my functions.php.
    And I’m still unable to see my featured images in the blog homepage, even though I have the option to set the when I edit posts. Any ideas?

  140. my theme uses featued image box in admin post panel , after adding the add_theme_support( ‘post-thumbnails’ );
    to the function.php , no new box(thumbnail) appears in admin panel.
    please help

  141. Thank you for this! I’ve been fussing with WordPress for weeks not trying to get a decent related posts plugin with thumbnail functionality to work and after finding this it now works.

  142. Thanks for the tutorial. Realised it’s native to WordPress 3 (the twentyten theme), so modified it accordingly (used specifically for the header image).

    Matt

  143. Thanks for this post my friend. I recently started with a bare bones theme and I’ve been building it up from scratch. This helped a great deal. I was able to tweak your code to get the size and effect of thumbnail that I needed for the site that I was working on. Thanks again.

  144. This is really helpful. I’m trying to create a homepage with thumbnails for each category then post thumbnails on the main category pages. Now it’s all about the layout..!

  145. kdpnja says:

    Now that we’ve moved to wp 3.0 and they changed post thumbnail to feature image what is the new php code?
    Instead of

    And do we still need to activate it in the functions.php?

    Thanks for your help!

  146. kdpnja says:

    What do I use instead of
    now that we are in WP 3.0 and they changed post thumbnails to featured images. Do I still need to activate it through the functions.php?

  147. Hi I just noticed that when you use:
    add_image_size
    It doesn’t give you an option for hard cropping an image? then found a WP forum thread that said it was due to images being uploaded prior to the change in dimensions,, after using the Plugin by Viper007Bond thumbs were resize again, yay! Still,,, shouldn’t that be important ? dynamic resizing? I know its an overhead, but it must be considered important no?

    Best
    Jeff

  148. Thanks, Mark!

    I have a small issue – I figured out that if you use WordPress image editing tools to (lets say) crop the image, and then use image as Post Thumbnail Image, generated image then doesn’t reflect those edits (like crop etc.)

    Could you shed the light how to make WP to generate post thumbnails with edits, made using WordPress image editing tool?

  149. Alex the greek says:

    Hi loved your post but I have a question, and I cannot understand why nobody else has asked it, as it’s driving me crazy…

    How do I set a featured image to be one of the other image size options instead of the original sized option?

    For example: I upload images that are 600 pixels wide, wordpress also generates a ‘medium’ sized image that is 300px wide (which I set in the media settings panel of the dashboard). I would really like to use the medium sized option as my feature image, not the original image. This would save lots of bandwidth, how can I do this?

    Thanks for your help! :)

  150. That’s just the info I have been looking for to use with my StudioPress theme. Thanks.

    Also, is there an easy way to set the thumbnail to be available in multiple posts or do I have to upload it each time.

    Thanks

  151. Spot on, just what I needed for a website i’m doing. I didn’t like the fact WordPress determind the height of my images for me, they should build your code into WP and give you the option.

  152. Jasmine says:

    Hiya, I am using a PHP loop, so not the main wordpress loop and needed access to this field and wanted to share my results with anyone else who may need this so I took a peek at the source and…

    You can use the function:

    get_the_post_thumbnail($post_id_here, ‘post-thumbnail’ );

    echo it to get the same behavior as the normal function, or parse it in PHP to extract the URL, whatever you need.

    Hope this helps!
    ~Jasmine

  153. Wahab says:

    Hi, really good post. But I am not sure what I am missing. I just downloaded Wordpres 3.0 with default “Twenty Ten” theme enabled but the “Post Thumbnail” admin panel is not visible.
    Please help me fix this.
    I searched on google and everywhere it says to put add_theme_support(‘post-thumbnails’); in functions.php

    Thanks for any help ….

  154. Thanks for the informative article – I’ll be using this technique from now on. The has_post_thumbnail is really useful if you have some pages that don’t have one.

  155. tom says:

    Hi,

    All’s nice but I cant change the size of the thumb in the teaser. Whatever values I put they still remain the same. Any solution for this?

  156. Steve says:

    Hi there, thanks for all the info.

    I would like my thumbnails only to appear on the excerpt on the home and archive pages. How can I achieve this?

    Thanks

  157. The are some method to do the action of regenerate the thumbnails scheduled? (by cron or opening some url with curl for example?)

    Thank you very much, and thanks for the great work!

  158. Hi Mark,

    I’m trying to get hyper links color changed in Amazing Grace them, I think you have left a comment there with your link to this blog. Can you please help me to figure out how to make pages and posts hyper links in blue instead of green color and sidebars to leave as it is in green? I ‘m still stack on how to create a variable in order to change it.

    Thanks
    Mike

  159. Totally not able to get this to work:
    All i am after is displaying a thumbnail on the category listing pages.

    I’ve added the theme support to my function.php file
    I’ve added “” to my index.php. Any suggestions? Very frustrating.

  160. секс знакомства в северодвинске май лав знакомства форум знакомств сайты секс знакомств узбекистана знакомства в новом осколе сайт знакомства знакомства сатка
    bestr of dati

  161. Mark,

    I’d like the first image in the article at the top to become a thumbnail automatically, and the ability to have a link to the article to see the remaining images, or to have the remaining images become thumbnails automatically as well.

    Automatic thumbnail options with automated cropping would make things much easier.

  162. jose miguel says:

    hello
    I have been testing the theme and is very good but I can not put the code for pictures in the index
    how to put the code in the correct place on file
    thanks

  163. Simply, amazing. Much easier to code than manually extracting the first image on each post to use as a temporary thumbnail. Plus it has other added benefits for being an optional, hand chosen thumb with the proper alt text. My clients will love it. Thanks a lot!

  164. Awesome! This is just awesome! Thanks dude! I was using a hack to make it work ( tags in the excerpt) and just updated all the files with this solution so the editors dont have to mess with html (they think its too complicated =P)

    Thanks again! cheers

  165. I still like the timthumb method.I don’t have to create a seperate thumbnail for each post that way,it automatically creates one.

  166. AJ says:

    This is a great tutorial but I would recommend adding it the following just in case someone is still using an older version of WP.

    if ( function_exists( ‘add_theme_support’ ) )
    add_theme_support( ‘post-thumbnails’ );

  167. ddeconin says:

    Hi,

    In my blog has_post_thumbnail() returns true , but the_post_thumbnail(); does not return anything.
    how can this happen ?

  168. Sean says:

    Hey Mark,

    What happened? This sounds like a great idea, but apparently it’s gone all crazy since you posted this. With the Twentyten theme and 3.0.1 I can’t make any of what you describe work, even though most of what you say to do has, apparently, already been done in that theme. I have to downgrade to 2.9.2 to make it happen. According to this post http://www.keleko.com/2010/setting-up-post-thumbnails-in-wordpress-3-0-with-twenty-ten/ one must jump through some serious hoops to make it fly with current versions.

    Any chance you might post a follow-up?

  169. Hi Mark,

    I used a tutorial by one of the support staff on itunes to create a magazine style home.

    I am also going to use Remote Publishing on my site have have it all working to a point. I can create the posts automatically with the php i have wrote but i was wondering f you know if there is any way i can use XML-RPC publishing protocols to add a featured image/thumbnail to the post???

  170. alain says:

    Thanks man.
    hey.. what if you wanted to fit the lowest side of an image?

    I wan’t your proportional crop hack (width, 9999), but that it fits the width OR height, according to which side is the smaller.

    That’s to have an image resized, but supports images that are NOT taller than wider.

  171. Hi there!
    I’ve got some questions about this great function:
    At first, it works great, but on my homepage there are of cause not only the thumbnails being displayed, but also the pictures being used in the first paragraph till the more-tag. I would like to remove this pictures, because they look really ugly on the homepage and destroy the formatting as well.
    The second question is, how to format the thumbnails. I would like to add a float:left, but I’m too silly for finding the right class.
    Hope, you can help me with this. Thanks!

    • So, now I’ve found the right class for formatting the thumbnails but the other problem stil exists. I’m searching for a the_content without pictures in it, I think…

  172. Notes from using catlist, as on page http://adriancowderoy.com/index.php/blogs/millou/one-live-cat/

    1) In the parameters, use “thumbnail=yes” rather than thumbnails as currently shown on http://foro.picandocodigo.net/viewtopic.php?f=28&t=251&sid=459191479fb09f81ebac3f3f61353827

    2) To make each image a hyperlink and put it at the start of each entry, rather than the end, edit the plug-in code for list-category-posts/list_cat_posts.php
    function lcp_display_post
    remove the clause if ($atts['thumbnail']==’yes’){ … } towards the end and insert a new second line of
    if ($atts['thumbnail']==’yes’){
    $lcp_output .= ‘ID) . ‘”>’ . lcp_thumbnail($single) . ‘‘;
    }

    • Umm, something got changed on posting. Trying again with the 1st 2 clauses, replacing triangular brackets with square ones. (Beware of the -] also needs changing to triangular.)

      function lcp_display_post($single, $atts){
      $lcp_output .= ‘[li]‘;
      if ($atts['thumbnail']==’yes’)[
      $lcp_output .= ‘[a href="' . get_permalink($single-]ID) . ‘”]’ . lcp_thumbnail($single) . ‘[/a]‘;
      }

  173. Hi Mark,

    Thanks a bunch truly! I am so glad I found your page. i wish I would have found it 5 hours ago..;).
    Got the thumbnails sorted out. cheeeeeeeers!

  174. MilanG says:

    Nice article, only one thing is not clear to me: It says that thumbnail can be added to pages, not only to posts. But, later, when printing it says the_post_thumbnail() has to bi inside loop?!?

    I’m adding images to pages, not to posts. I want every page to have different, images in header. How to do it without loop?

  175. Pingback: Anonymous
  176. Note that the call to set_post_thumbnail_size in functions.php may have no effect in some themes, such as K2.
    Then you need to go to the templates (blocks/k2-loop.php and /single.php), and set the size in the existing the_post_thumbnail(…) call.

  177. This is brilliant – fantastic if you need multiple image sizes for different posts/pages. If the ability to resize existing images were included it would only get better.

    Thank you very much.

  178. This is brilliant. Fantastic if you need multiple image sizes for different posts / pages – or just about anywhere.

    If you could add this to existing images it would be even better.

    Thank you very much.

  179. Pedro says:

    Hi, is there anyway I can remove the post title from showing up, leaving just the thumbnail? Im running an events site and the title isnt too necessary, and the combination of both makes it look a bit odd

    hope to hear from you soon

    thanks in advance, great plugin!

  180. Great guide man, thnx! Do you know if there is a way to alter the thumbnail selection of an image after you have uploaded it? My client has a lot of different images and sometimes she wants to crop it right and sometimes left..

    It would help me out.. thnx again.

  181. Hey Mark-

    I’m have trouble uploading post thumbnail images in my Lifestyle theme. I have Dynamic Content Gallery that works well. I have the featured images working well but can’t seem to get the post thumbnail images to appear.
    Any help is truly appreciated

    Thanks!

    Ben

  182. Jeff Meadows says:

    WordPress allows you to set a custom link for an image. Does any one know how to display the featured image with that link? The idea is to click on a featured image and go to an external website as set in the image link box; not the post and not the file.

  183. Mark, thanks for your great insight. The issue I’ve been having is the category posts within the tabber widget. It strips out tags, including images. My theme has post-thumbnail support enabled.

  184. function lcp_display_post($single, $atts){
    $lcp_output .= ‘[li]‘;
    if ($atts['thumbnail']==’yes’)[
    $lcp_output .= ‘[a href="' . get_permalink($single-]ID) . ‘”]’ . lcp_thumbnail($single) . ‘[/a]‘;
    }

    is this enough? Please, is there a plugin to help me to add images to my blog?

  185. No sorry, as the theme I have is a portfolio, all i need to do is link to the post.

    For a Photography Portfolio the full image would just be all or part of the post.

    For a Services Portfolio or category maybe for a WordPress template website, the image could be part of the post or not for a case study.

  186. Pingback: Blog Thumbnail?
  187. Nilamkumar Patel says:

    Thanks Mark, the article is fine but a suggestion, if you can elaborate with some screenshots it would have been much better because the beginners like me can not really get the exact thing we are searching and obviously every requirement is not the same as you post, so it could have helped me much better if you’d have posted some screenshots in the post,

    Regards
    Nilam Patel

  188. christo says:

    Hi there, I added the code to my functions.php and my main index.php file. I get the thumbnails displaying on my homepage so it is working. The problem is that when I try to publish a new post the post.php file does not seem to load. Can anyone help me?

  189. Hi,
    Need help badly. My product pictures dont show up in full in the website pages. Dont know how to getthem all look uniform and in the same size. Mt website designer isnt of much help. I need the jewelry pics to be of the same size.
    Can you walk me thorugh it please. I am not super tech savvy. ANd am using wordpress

  190. i installed this plugin in my website and i used thumnail feature.so the thumbnails are at displaying a part of the image,but they are not auto resizing i want the plugin to be like that. can you tell me what more i have to do for auto resizing of images

  191. Peter says:

    Hi, this just does not work for me – the list works, but I get no thumbnails – I have followed above, the only thing I’m not sure of is were to put the loop code. – also I’m using wordpress 3.1.2.

    any ideas?

  192. Роман says:

    Автокондиционеры-установка на отечественные автомобили, все грузовые, трактора, сельхозтехнику. Заправка, диагностика, ремонт г.Орехово-Зуево. продажа комплектов для самостоятельной установки автокондиционеров на отечественные автомобили.

  193. AnsRssElio says:

    ???! ????? ???? ????????????? ????? Ca$iity9 ? ????? ?????!
    ?ea??! ?i??ea?e?? ?aa?a??u oi????a?? ei??a i?e?a???? au?i? e??u Ca$iity10 ? ?ia?e?i ca e?oi??a?e?!
    ????? ?????!

  194. Брачное агенство «Elmi» – это огромная база данных по всем городам Севера Израиля, персональный подход, разнообразные методы работы. Мы предложим ту форму обслуживания, которая подходит именно Вам. Для нас важно, чтобы Вы чувствовали себя уверенно и комфортно. Мы вместе с Вами работаем на конечный результат.

    Мы работаем в Хайфе, Краёт, Мигдаль Аэмек и других городах севера страны.

  195. By my research, shopping for consumer electronics online can for sure be expensive, but there are some tricks and tips that you can use to help you get the best deals. There are always ways to uncover discount deals that could help to make one to hold the best electronic products products at the lowest prices. Good blog post.

  196. Hi Mark, I change the line into the “functions.php” as you spoke to show the thumbnail only in my pages and do not show it in my posts. When I changed to “add_theme_support( ‘post-thumbnails’, array( ‘page’ ) );” my config box (in posts page) is disappeared. Can you help me on this? Thanks and sorry for my english :)
    P.S. my template is Evolve.1.2.5

  197. When will they make featured images a standard feature? not sure if it’s just some of the templates I use, but that helpful feature isn’t available a lot of the time. Really reduces time spent manipulating thumbnails, etc.

  198. I’ve tried getting this working with the BuddyPress bp-default theme, but to no avail. Is the method slightly different there? Has anyone else got it working?

  199. Prebranes says:

    В современной диетологии существует огромное количество различных диет, ставящих целью снижение веса. Автор одной из них, Вильям Бантинг, утверждает,
    Не все диеты одинаково полезны! Нет диетам, или Простой путь к снижению веса · Низкокалорийная диета (считаем калории) · Низкоуглеводная диета
    Как стать здоровой и красивой – диеты для красоты, диеты для здоровья и средства для похудения.
    29 май 2011 Диеты для похудания, похудение, как быстро похудеть, средства похудения, эффективно похудеть, худеем легко и быстро, сбросить лишний вес.
    Медицинский центр Серсо: эффективное и быстрое похудение, снижение веса по уникальной запатентованной методике. Похудеть без диет и физических нагрузок

  200. That’s a great tutorial! However that doesn’t do the trick for me…
    On my blog I currently use custom fields to show up the images on the pages. When I replace the line: <img src="/” alt=”” class=”left” width=”300px” height=”270px” />
    with:

    the image does show up but the text, just right to the picture, does disappear. I assume / know that this has something to do with the Class=”left” element, but what ever I’ve tried I couldn’t get it right! :( I’m doing something wrong?

    Also, can this be used with timthumb.php as I’m using this one to shrink the pictures as well.

    Thanks.

  201. Pascalw74 says:

    Hi there,

    I do not determine if I’m in the suitable place markjaquith.wordpress.com to publish my question however I’m not really so accustomed to forums, apologies beforehand if it’s not with this I had to publish .

    This is my personal difficulty. I actually absolutely need to get a website for that business I’m going upward however i can not afford to pay for us a web site two thousand as well as three thousand euros.

    So is it possible you advise us connected with style and design application cost-free web site i try and get by or perhaps, from most severe, the companies that can produce our web page regarding really low-cost?

    Appreciate your support.

  202. the The post is very good.
    这个文章太棒了。

    Where Can I Buy这个文章太棒了。
    The post is very good.

    The post is very good.
    这个文章太棒了。

    scam
    The post is very good.
    这个文章太棒了。

    Discount
    The post is very good.
    这个文章太棒了。

    sam
    The post is very good.
    这个文章太棒了。

  203. I read so many reviews of the DeLonghi 15 Bar pump espresso maker and they were so overwhelmingly great that I bought it. I’ve been using it for about a week and I love it. I went from a steam machine to this one, and the CREMA is such a thick and beautiful golden, and the coffee hot. I’ll leave a couple of tips as I read from others that helped me the most.
    1. Read and follow the brief and very clear directions in the booklet. Run clear water through to clean the inner workings.
    2. Preheat that machine for 15 minutes, and put hot water in your cups while you’re waiting. The heated top is not that hot, but is a little helpful, the heating with hot water from the tap is best.
    3. Don’t forget to use the tamper, to get the crema. When you do it, place the holder under the tamper and make a smooth motion to the right- sort of “swirling” the coffee into a smooth top.
    4. I steam the milk for cappucino first, so set the steamer button, and do that so that your coffee is hot when you add the milk and foam. If you do it the other way, your coffee is cooling as you are frothing!
    5. People have complained about the placement of the milk frothing device. Really no big deal- you can pull it out a bit, and once your frothing pot is in place, the device does the rest, very little need for moving it around- I was amazed.
    6. Enjoy a delicious and hot cup of coffee. I know that ILLY is expensive, but I do think it makes a great cup. Lavazza is a reasonably priced alternative.
    I hope my comments have helped.
    PS If one other person complains about the plastic parts- like the drip tray or water holder I’ll scream. If the whole thing was stainless steel the unit would be twice as expensive. The important parts are steel and that’s what makes it affordable
    Good luck and I hope this helps.

  204. I actually absolutely need to get a website for that business I’m going upward however i can not afford to pay for us a web site two thousand as well as three thousand euros.

  205. Bill says:

    How can I modify the js to deactivate the links in my home page thumbnails? They display fine, but I don’t want to use them as navigation elements. Thanks!

  206. Mike C says:

    Hi Mark,
    Is the core functionality you describe above the same as this plugin:

    http://www.evilgenius.anshulsharma.in/cgview/

    I want to create a video gallery in WordPress, using thumbnail images to link to the full post instead of a typical excerpt or whatever. Think of just a grid of thumbnails. That’s what I want to show for just one category on my site. Is this possible with your tutorial or do I need the plugin?

  207. Thanks for every other great post. Where else could anybody get that kind of info in such an ideal means of writing? I’ve a presentation next week, and I am on the look for such information.

  208. I’d like to add here that while adding the add_theme_support(‘post-thumbnails’); is exactly what you need, having this:

    add_theme_support( ‘post-thumbnails’, array( ‘post’ ); // Add it for posts
    add_theme_support( ‘post-thumbnails’, array(‘page’); // Add it for pages

    actually overwrites support for posts with support for pages. You have to either delete the one you don’t want to use or add ‘pages’ (and other CPTs, if you’re using them) to the same array, like:

    add_theme_support( ‘post-thumbnails’, array( ‘post’, ‘page’, ‘custom-post-type’);

    The way this is written, if you aren’t careful, you might take the author to mean that adding both of those lines (with post and page, respectively) will add support for pages and posts. But note that immediately after providing this code, Mark said to “DELETE” the one you don’t want to support.

    Just thought I would share this, since I spent several minutes trying to figure out why NO post types were supporting featured images.

  209. Priya says:

    This is what i am having in my theme “cover wp” theme under function.php but no thumbnails are showing up with the post, i tried to remove this and add your code but nothing worked, please kindly go through my code and let me know why itsn’t showing up

    // Post Thumbnails

    if ( function_exists( ‘add_theme_support’ ) )
    {
    add_theme_support( ‘post-thumbnails’, array( ‘post’ ) );//Add it for post
    set_post_thumbnail_size( 50, 50, true ); // 50 pixels wide by 50 pixels tall, hard crop mode
    }

    function display_thumbnail($width, $height, $words,$inc)
    {

    if ( function_exists( ‘has_post_thumbnail’ ) && has_post_thumbnail() )
    {
    $title = get_the_title();
    the_post_thumbnail(array($width,$height), array(‘alt’ => $title));
    }
    else $words = $words + $inc;
    return $words;
    }

    Priya

  210. So, in function.php display, I can add:

    add_theme_support( ‘post-thumbnails’, array( ‘page’ ) ); // Add it for pages

    And that’s it? I have a plugin for generating and sizing thumbnails, so will it be okay if that’s all I put in the editor? Also, where do I paste it in? I’m scared to edit because the only other time I tried, I created an irreversible fatal error.

  211. coda says:

    Hi,
    thanks for explanantion, it is very useful.
    What is the name of the output variable of the_post_thumbnail(); function?
    Namely, I have to delete title attribute in IMG tag.
    Thanks.

  212. If I want text to appear next to the thumbnail and continue down the side of the thumb. Is this possible?
    So the thumbnail isn’t just taking up part of the width or the post and leaving the side bare.
    This is my blog. http://www.strictly-porn.com and as you can see the images take all the space.

  213. You really make it seem really easy with your presentation but I find this topic to be actually one thing that I think I would by no means understand. It sort of feels too complicated and extremely large for me. I’m having a look ahead on your next post, I’ll attempt to get the hold of it!

  214. thathMex says:

    talia amateur allure anal
    anne hathaway interview anal sex
    austin kincaid does anal
    erotic stories anal beads
    free bubble but anal video
    arkansas anal
    anal tentacle sex
    enlarged veins around anal canal
    anal isex
    homemade anal sex toy
    jesse jane anal scene
    anal brutal insertion
    shemale thai anal
    free hardcore gangbang anal vids
    kinky anal latex porn stars

  215. I don’t even know the way I ended up right here, but I thought this publish was once good. I don’t know who you might be however definitely you’re going to a famous blogger for those who are not already. Cheers!

  216. This is great stuff – I can’t believe I’ve only just discovered this functionality! I’ve been using and customising WP for 5+ years and missed this improvement. Anyhow, now that I’ve found it I naturally want to use it. However, one issue I have is that my previous solution relied upon the ‘featured’ image thumbnail being part of the excerpt. I then go on to use that excerpt elsewhere and use preg_match to get the thumbnail SRC. I can see two ways to solve my problems – either being able to call something like the_post_thumbnail() outside the loop with post_id as a parameter, or a way to build a loop that provides, chronologically, 4 posts before and up to 4 posts after the current post.

    I hope that all makes sense and you can find a mo’ to offer advice…

    Regards, Pete

  217. I was customizing my theme then I thought to add featured image to the post I was not able to that but here the trick has worked thanks for this post…!!

  218. Hello There. I found your blog the use of msn. This is a really well written article. I will be sure to bookmark it and come back to learn extra of your helpful info. Thanks for the post. I will certainly return.

  219. Kev says:

    I’m not sure what it is called but for some reason how I post Blogs changed on me and for the life of me can’t figure out how to get it back to the way it was..

    I used to be able to be able to post a blog and have the option to copy past a doc from Microsoft Word, also when I uploaded photos to my blog I had the option to edit them in the blog to desired location and size, so now all I have is one option for my blog posting. I think it is called HTML?

    Sorry for sounding like such a newb, but the other option was just easier for me to post a blog, now when I insert a photo everything is in code and makes it more difficult for me to do my work..

    Thanks for any help anyone can offer or hopefully get me back to the way I was..

    Thanks
    Kev

  220. ร้านจำหน่ายเสื้อผ้าเด็กและของเล่นเด็กเล็กที่มีคุณภาพ Thanks… I used to be able to be able to post a blog and have the option to copy past a doc from Microsoft Word.

  221. I also had grief, and no success, using this method for the sizings Mark. Both single and normal thumbs would register and display. Thanks !!!

  222. Thanks for the great tutorial. I have everything up and running with WP 3.0. but it does not work at all with WP 3.0.. The theme works otherwise jsut fine. ALso when I am trying to add the thumbnails according to the tutoria to new theme running on WP 3.1 I have no luck.

  223. Eric S says:

    David,
    DO you know how to make the thumbnail point to the fullsize image of itself?
    I have the files setup to pull the image to the permalink on all pages, but on the singlepost, I would like the thumbnail to pull up the fullsize of the image.
    The stuff I tried makes it put “img width=”” and so forth

  224. No sorry, as the theme I have is a portfolio, all i need to do is link to the post.

    For a Photography Portfolio the full image would just be all or part of the post.

    For a Services Portfolio or category maybe for a WordPress template website, the image could be part of the post or not for a case study.

    david

  225. veda says:

    Hello!

    I need to do something like this:

    if ( has_post_thumbnail() ) {
    the_post_thumbnail();
    } else {
    $thumb = getFirstImagefromPostandResize ();
    set_post_thumbnail($thumb);
    the_post_thumbnail();
    }

    getFirstImagefromPostandResize it’s ok code already available based on plugin.

    I need to know how to do for this kind of function in wordpress : set_post_thumbnail($thumb)

    in order to store my automatically generated thumbnail

    and reuse it transparently with the_post_thumbnail() without passing by manual GUI uploader (set thumbnail);

    Do you know how to do it? which function i have to call in wordpress?

    thank you very much for your answers.

  226. Eric S. says:

    THank you for your reply at least!

    I need to jump back into the code to figure out how to strip out the file being renamed with the sizes I think?

Comments are closed.