219 Responses

  1. Andy Towler
    Andy Towler Published |

    Thanks for this – I have a new WP magazine-style project coming up for which this will be ideal. Now I just have to hope that WP 2.9 is released in time for when I have to start the project!

    Reply
  2. Tutorial: the_post_image Funktion nutzen… | Wordpress Lesezeichen
  3. Ben
    Ben Published |

    Hey Justin – that’s a pretty good round up. Thanks for linking to me too :)

    I agree entirely that this is a cool feature, and I will be making use of the ‘get_the_post_image’ function in my future themes, however for the actual resizing and cropping I think I will stick with TimThumb… for the time being at least :)

    Reply
  4. Ryan
    Ryan Published |

    Any idea why we now need to add the add_theme_support( ) function into our themes? I was using a trunk install and was surprised when it suddenly stopped working on upgrading after they required that function to be added. I can’t see what purpose it serves though.

    EDIT: I think I now know the answer. It’s so that the post thumbnail option doesn’t appear in the admin panel unless the theme supports it. That does make some sense, I just didn’t click until now.

    BTW, in the code block under “Checking if the post has an image” the code says it’s a link, but I think you intended to be an IMG tag.

    Reply
  5. Ryan
    Ryan Published |

    “I imagine the idea was to cut back on the number of support queries such as, “My post thumbnail isn’t showing!!!” ”

    Yeah. I could imagine the WordPress.com support forum getting inundated if they introduced that without adding support into EVERY theme on their site.

    I have sites of my own that don’t use thumbnails too and I imagine my post writers would also get confused by a strange thumbnail box that didn’t do anything whatsoever.

    Reply
  6. Dan Philibin
    Dan Philibin Published |

    I have probably used your Get The Image plugin on just about every theme I’ve done in the past month or two, so obviously the need is there for built-in post image support for WordPress.

    There’s still a problem with the media uploader, though, which could keep this system partially crippled. Sometimes I upload an image and insert it into the post but it’s NOT saved in the post’s gallery. WordPress’s post image feature probably won’t have the “image scan” feature that your plugin thankfully does, so hopefully they fix this with 2.9.

    Nice writeup!

    Reply
  7. Cory howell
    Cory howell Published |

    This looks like a great feature that will save lots of time manually assigning thumbnails & working w/ 3rd party plugins.

    Kudos to WP for including this in 2.9 – very much looking forward to using it.

    Reply
  8. Grant Palin
    Grant Palin Published |

    This is a long-needed addition to the WP core. I’ve used the custom field technique for some time, and it worked, but I thought it really should be part of WP out of the box. Looks like it will be soon enough! Thanks for the overview. Will keep the information in mind when I look at updating my site’s theme.

    Reply
  9. The Frosty
    The Frosty Published |

    That’s pretty cool, I started to play with this feature in a theme I was working on, but I updated 2.9-rare a a few days back and that features magically disappeared…

    Got to play with it just enough though, may check the update, could be back by now..

    Reply
  10. Steve Taylor
    Steve Taylor Published |

    Thanks for the summary. But… bah. I’m just finishing a site that could have done with this. What I’m doing is getting people to upload an image through the upload / insert popup, making the image title something like “featured”, then just saving changes (not inserting into post). So the image is attached to the post, with a specific title – I just use the normal WP attachment functions to grab the thumbnail of it.

    I’ll probably try and streamline things with this feature in the future, but out of curiousity, do you know if this new feature is separate from the “attachment” system? Is this image stored in the Media Library?

    Reply
  11. WordPress 2.9’s post image feature « Weblog Tools Collection
  12. Jean-Paul Horn
    Jean-Paul Horn Published |

    Will the new post images adhere to the image sizes we’ve defined in Settings > Media. From your (outstanding) article I gather that’s a Yes, which is unfortunate since our feature panel uses a non default image size (and for which I use the unrivaled Get The Image plugin with custom fields). I’ll probably leave it like we have now, although I might take advantage of this new feature to recode the theme slightly and have the feature box use the medium image. Adding a feature image is a lot of manual work right now and thus an unnecessary burden to our authors. The new Post Image feature makes this a whole lot simpler for them and I’ll just to need to add some extra code.
    Will definitely wait for the new Get The Image, since I’ll still be needing that :)

    Thanks Justin for both this explanation and your plugin(s)!

    Reply
  13. Jay
    Jay Published |

    Nice that WordPress finally made that feature! Regarding that with the old thumbnails will be lost. Isn’t it possible to do something like this?

    < ?php
      if ( has_post_image() )
         the_post_image( 'thumbnail' );
      else
        echo '';
    ?>

    ($thumbnail is the custom field value)

    Reply
  14. Jason Pelker
    Jason Pelker Published |

    I’ve been wondering when you might have some words about this new feature. I’m also curious if you have any development credits for getting this feature into WordPress 2.9.

    Reply
  15. Tinh
    Tinh Published |

    Is this feature built in the WP 2.9 version or we need to manually tweak the theme? Thanks, it is cool feature indeed and I love it too

    Reply
  16. Weekend Roundup #61
    Weekend Roundup #61 at |
  17. Mike Smith
    Mike Smith Published |

    This is awesome. Thanks for posting up the codes for it too – will definitely help when I launch a couple themes in the next two months.

    If I added the codes ahead of time to the functions.php file and added an if/else for the posts to either use this code or the default custom field code, would that break the theme if people use it with 2.8.6? I’m just thinking if I release the themes ahead of time before 2.9 comes out, I’d like to have this already built in.

    Thanks

    Reply
  18. WPspecial – Wordpress Magazine » WordPress 2.9’s post image feature
  19. Ade
    Ade Published |

    Excellent write up as ever Justin.

    I’m just wondering… how (if even possible), would you make it so the thumbnail is linked to article for navigation purposes

    My theme came with “get the image” plugin built it

    I’ve implemented the code above on a mirror test site of my site, replacing the following code…and although the images are appearing fine, they are obviously not clickable. And unfortunately my php knowledge is not good enough to work out the code i need. Can you point me in the right direction.

    Reply
  20. Ade
    Ade Published |

    sorry – my code got dropped… i don’t know the command to show code, it’s clearly not backtick as i’ve become used to.

    Reply
  21. Faizal
    Faizal Published |

    I’ve currently tested the Wordpress 2.9 Beta-1 but can’t found that Post Thumbnail Meta Box in the post editing screen. Anyone know why ???

    Reply
  22. Agung
    Agung Published |

    great info.. but any know how to auto resize image..? not large to small. but from small to large post inside. thanks

    Reply
  23. Morten
    Morten Published |

    I guess it is going to work pretty similar to the feature like i have on my template, if so it is absolutely great.

    I especially like the feature with usage of default picture i am missing that part on my template.

    Reply
  24. Darran
    Darran Published |

    Nice tutorial, I could follow it quite easily and will probably not get down to testing this feature until 2.9 is officially out due to my sheer laziness. This means one less plugin to themes who want to have a custom post thumbnail.

    Reply
  25. Jessi
    Jessi Published |

    My site also could’ve used this. Oh well. I’ve been using a plugin called Smart Image for a while now. It doesn’t use custom fields though. Come to think of it, it’s pretty much exactly like the new WP feature. It’s just not built-in obviously.

    Reply
  26. john@Baby Pushchairs
    john@Baby Pushchairs Published |

    Before reading your post, I had so many queries regarding how to post the image feature in Wordpress. But, now, I don’t think that I have any doubts regarding that. Thanks for the information.

    Reply
  27. Ridgely
    Ridgely Published |

    Ok, this is a painter-needs-to-build-her-own-damn-website dream come true. At least I think – could you use this feature to more effectively whip up a site like this?

    Reply
  28. Morten
    Morten Published |

    @Justin

    That is great news from all wordpress bloggers, i picked my template as my pages basically is about travelling, and pictures in that case is a must have.

    The number of visitors, which pictures can create totally surprised me, the tricky part is to get them on the page, not just having them look at the images they found in Google.

    Anyway great news, that the new Wordpress feature will work similar to the Get the Image functionality.

    Morten

    Reply
  29. Daily Digest for November 22nd | More Than Scratch The Surface
  30. Bookmarks for November 12th through November 22nd « Peng’s Blog
  31. Weekly Links #80 | GrantPalin.com
    Weekly Links #80 | GrantPalin.com at |
  32. KokPinLab
    KokPinLab Published |

    Hi Justin,

    I always like your post and it is so simple and concise to learn some new feature on wordpress.

    Thank you.

    Reply
  33. Jake
    Jake Published |

    Great information, thanks for sharing. The code is really helpful as I am planning an upgrade once 2.9 is released. I’m a first time visitor and wanted to say this looks to be a very useful blog. Your work is much appreciated!

    Reply
  34. Kelli - PLC Programming Guru
    Kelli - PLC Programming Guru Published |

    Justin,

    Thanks for the step-by-step. Frankly, I’m not the most technically inclined person but based on your explanation I think that I will be ready to use Post Thumbnail once I upgrade to WP 2.9. Hopefully, both will be as “easy” as I would hope.

    Reply
  35. Ashley Lekov
    Ashley Lekov Published |

    Thank you for the informative post, as always. Looking forward to the upgrade.

    Reply
  36. moshe ovadia
    moshe ovadia Published |

    i try the beta of wp 2.9 but icant find any Page thumbnail box !!!
    “you’ll see a new meta box labeled “Post thumbnail” (or “Page thumbnail” for pages).”
    where is the post thumbnail.

    Reply
  37. moshe ovadia
    moshe ovadia Published |

    Ohhhhh, i understand now “add_theme_support( ‘post-thumbnails’ );” at the first i thought the function used only for theme support!!!! not for the admin post or page editing

    Reply
  38. Andri
    Andri Published |

    And I am so satisfied with the auto thumbnail script in your hybrid theme… with an easy single clicks any articles will have customized image thumbs :)

    Reply
  39. brainsolid
    brainsolid Published |

    Justin, you talking about Get the Image plugin, that help do not lose old thumbs. Are there some way to resize these old thumbs?
    For example, i use 100×100 px thumbs and now want to enlarge them to double-size.

    Reply
  40. WordCast 75: WordPress 2.9 and Beyond | Kym Huynh
  41. Doug Bedient
    Doug Bedient Published |

    Added the code bit to my themes function.php file at the last line 434 and no activation. Emptied cache. Different browsers. Still not there. Curious… 2.9-beta-1. This is the most complete, easy to follow article I’ve found though. Good work.

    Reply
  42. Suzanne
    Suzanne Published |

    Justin thanks for the great article – I’v got this implemented in an upcoming revision of a fairly large magazine site I manage. I have a question tho – you don’t happen to have an easy way to get just the URL of the post image (by size) do you? These functions get the entire IMG tag, but I’d like just the URL to the image itself.

    Reply
  43. darila
    darila Published |

    Well, it breaks some stuff in older installations, but its a very nice new feature in wordpress 2.9

    greeting, darila

    Reply
  44. Aldo
    Aldo Published |

    Hi Justin,

    there is a typo in the code block under the paragraph “Changing the HTML output of the post image”. At the end of the second line, there is a ; instead of a {

    Thanks for your helpful posts.

    Reply
  45. WordPress 2.9, c’est pour bientôt !
    WordPress 2.9, c’est pour bientôt ! at |
  46. bob
    bob Published |

    I tried it out, and it looks like the only thing that the Post Thumbnail write panel adds is the ability to just embed an image in your post. I thought it would have been a separate feature, where in previews only the post thumbnail would be displayed or some different type of functionality. But it only gives you the ability to insert an img tag in your posts. Does it do more? What’s the reason behind the hype?

    Reply
  47. Matt M.
    Matt M. Published |

    It’s great that they are implementing this feature into wordpress finally. As time has progressed and thousands of blog themes have been developed, a ton of them are including thumbnails next to the posts and excerpts. It is not exactly easy to hand-code this all the time, especially for inexperienced developers. I can also see this feature being great for portfolios and case study pages!

    Reply
  48. jamee
    jamee Published |

    I really love to use wordpress and as stated here there are so many blog themes avilable and these things should have in mind while using wordpress. This post makes those very well aware who just have to use this but are not aware of it well.

    Reply
  49. bob
    bob Published |

    But Matt M., it’s as easy as simply typing in your post content…

    Reply
  50. Fairweb
    Fairweb Published |

    Thanks Justin,
    I had written something similar on my blog (in french) http://weblog.fairweb.fr/archives/2009/12/05/wordpress-2-9-la-vignette-dun-article-en-natif/ and just linked back to your post as it is much more detailled.
    I’ve also written a plugin http://wordpress.org/extend/plugins/fw-post-image/ where I used your idea (and a couple of lines of code) of scanning the post content. Feel free to extend it as you wish or, if your plugin does something different, take some of my code if you find it helpful. Do not hesitate to contact me by email.

    Myriam

    Reply
  51. Devin
    Devin Published |

    Thanks for the write up Justin. I was curious if it worked on pages as well as posts. Just added the code and it does.

    Reply
  52. Kretzschmar
    Kretzschmar Published |

    Just a small note. The WordPress Team has renamed those new functions. instead of _image all functions end with _thumbnail. So has_post_image becomes has_post_thumbnail.

    Reply
  53. cdharrison.com » archive » the_post_thumbnail for RSS feeds
  54. Fairweb
    Fairweb Published |

    I searched for get_the_image plugin in the WP extends but did not find any new update. When do you intend to release it ?

    Reply
  55. Shawnsandy.com Blogs:: Just another Shawnsandy.com weblog:: Get Ready WP 2.9 Almost Here (2.9 RC1)
  56. William Lindley
    William Lindley Published |

    One example of a plugin that already supports 2.9 is the AutoNav plugin ( http://wordpress.org/extend/plugins/autonav/ ). It uses the “post thumbnail” when it creates a table of child-pages… so if you have a page, “Cruises” and each of its child pages (Tahiti, Hawaii, etc.) has a post-thumbnail, you would get a set of images like a menu of them.

    Reply
  57. WordPress 2.9 Enhancements Every Developer Must Know | CMS-MASTER
  58. Wordpress 2.9: Novità per Utenti e Sviluppatori - Wordpress
  59. Jauhari
    Jauhari Published |

    I still enjoy your Get The Image plugin ;) But this features also useful

    Reply
  60. Wordpress 2.9 er ude » kraenbech.dk
    Wordpress 2.9 er ude » kraenbech.dk at |
  61. Urlaub Kroatien
    Urlaub Kroatien Published |

    Marry Christmas and happy New Year 2010 from croatia.

    Reply
  62. Post_thumbnail in WP 2.9 | Beginwithanidea
  63. Danne
    Danne Published |

    This was really a great tutorial, considering every aspect I would say. I’ve copied it and will use it. It will help me right away. Thanks

    Reply
  64. JHouse
    JHouse Published |

    Yesssssssssssssssssssssssssss!!! I was using Post Thumbs Revisted for the last year or so, but it wasn’t working properly after I upgraded to the latest WP. Soooo, I tried numerous other plugins, but none of them met my client’s needs. With the plugin you suggested, coupled with WP 2.9 and your custom code, it all works like a champ now. So stoked!!! Thank you so much for your WP wisdom.

    Happy New Year!!!

    Reply
  65. webmatrix
    webmatrix Published |

    Thanks for the review. Now I’m just finishing a site that could have done with this. What I’m doing is getting people to upload an image through the upload / insert popup, making the image title something like “featured”, then just saving changes .
    Thank a lot for sharing youre good thought……….

    Reply
  66. Jamie O
    Jamie O Published |

    LOVE the potential of this – especially with being able to edit separate crops for the separate photo sizes. Square thumbnails for product galleries with more appropriate non-square for detailed photos.

    Having a strange quirk that when I put the add_theme_support( ‘post-thumbnails’ ); in my functions.php file and refresh in the admin, any time I try to select a photo from the media library it shows no results. Remove the line and the list of photos does show. Any thoughts?

    Reply
  67. WordPress 2.9: Post Thumbnail Images | gidibao's Cafe
  68. WordPress 2.9 | New Features | WordPress Theme Customizations
  69. Im Ernstfall » Thumbnails in Wordpress 2.9
  70. Babel
    Babel Published |

    “What happens to my old images/thumbnails?”
    why dont use the old AND new method? if there is a special-field declared then use it. if not use the new method no prob ;)

    Reply
  71. Babel
    Babel Published |

    “How to return the image instead of displaying it” thx that helped me very much that was the problem i’m searching for! :)

    Reply
  72. WordPress 2.9: The Bloggers Gift for the Holidays | WordCast - Blogging news, WordPress help, WordPress plugins, WordPress themes, WordPress news
  73. wordpress seo
    wordpress seo Published |

    Thanks for the write up Justin. I was curious if it worked on pages as well as posts. Just added the code and it does.

    Reply
  74. Bjarne // Mums Studio
    Bjarne // Mums Studio Published |

    Justin, a very good read! Wasn’t aware of the possibility to edit the HTML output. That’s really handy…!

    Thanks.

    Reply
  75. WordCast 75: WordPress 2.9 and Beyond | WordCast - Blogging news, WordPress help, WordPress plugins, WordPress themes, WordPress news
  76. Everything you need to know about WordPress 2.9's – Justin Tadlock … | Wordpress Marketing
  77. Chas
    Chas Published |

    Does anybody know if we can have next and previous thumbnails for navigation on posts and what the code would be?

    (This article was very helpful and was an asset for me setting up my website for post thumbnails.)

    Reply
    1. Chas
      Chas Published |

      I am replying to my question. A plugin has been developed that works as a widget and shows the next/ previous thumbnails. It also has several other nice options. The name of the plugin is called “Post Navigation Widget”. It can be downloaded from from the Wordpress Pligin Directory.

      Reply
  78. WordPress 2.9 “Carmen” is out!
    WordPress 2.9 “Carmen” is out! at |
  79. Adding posts thumbnails in WordPress 2.9+ · brand:GNU
  80. links for 2010-01-18 | Digital Rehab
    links for 2010-01-18 | Digital Rehab at |
  81. nagradne igre
    nagradne igre Published |

    Its a lot of nice features in 2.9 version od wordpress
    I was searching for how to return the image instead of displaying it and found it here, thanks…

    greetings, nagradne igre

    Reply
  82. wordpress » XMM.IR
    wordpress » XMM.IR at |
  83. Everything you need to know about WordPress 2.9’s post image feature « Kille Blog
  84. Ruth @ WordPress Toronto
    Ruth @ WordPress Toronto Published |

    Great post. I’ve been using the Get the Image plugin on most of my sites making for a smooth transition to 2.9. Check out my latest post for an updated detailed walk through of the new Image Editing features. Uploading and Editing Images in WP 2.9

    Thanks

    ~ Ruth

    Reply
  85. Using Post Thumbnails in WP
    Using Post Thumbnails in WP at |
  86. Ceapa
    Ceapa Published |

    This was really a great tutorial, thanks!

    Reply
  87. Istrien
    Istrien Published |

    Thanks for helpful post.

    Reply
  88. Andy H
    Andy H Published |

    Thanks for the lovely article. One thing I cant figure out is how to get the thumbnail to act as a link to the ful size image? Not to the post.

    Thanks again :)

    Reply
  89. Wordpress Post Thumbnail « Yellowecho.com
  90. Zac
    Zac Published |

    Nice article, do you know how you can return the filename rather than the ID of an image being used?

    I want to return the filename of an image being used on a main page, then modify it so I can use it to call another image for the subpages depending on what template is being used for the sub pages (i.e. main page thumb = “image-wide”; sub page thumb = “image”-narrow).

    Unfortunately I can’t just resize and re-use the image as it won’t fit the templates.

    Thanks,

    Reply
    1. Zac
      Zac Published |

      Sorry, to clarify… I thought that your instructions under “How to return the image instead of displaying it” ($image = get_the_post_thumbnail( $post->ID, ‘thumbnail’ );) would do this but it doesn’t seem to, it just displays a thumbnail version on my page.

      Reply
  91. Myshock
    Myshock Published |

    I justin. Thanx for this article.
    I would like to extract the post thumbnail url to use it with css.
    How can i do that ?
    is there a function like “the_post_thumbnail_url”
    Thanx for help.

    Reply
  92. Myshock
    Myshock Published |

    Sorry to annoy you seemed to be something like that :

    Wrote that little function that works fine.

    [code]function get_post_thumbnail_url( $post_id = NULL ) {
    global $id;
    $post_id = ( NULL === $post_id ) ? $id : $post_id;
    $image_id = get_post_meta( $post_id, ‘_thumbnail_id’, true );
    $image_url = wp_get_attachment_image_src($image_id);
    return $url[0];
    }[code]

    Reply
    1. Myshock
      Myshock Published |

      I’m sorry last line is :

      “return $image_url[0];”

      Reply
  93. Mufet
    Mufet Published |

    until now I still use wordpress 2.8
    not dare to upgrade
    btw, thanks for the tutorial

    Reply
  94. Post Thumbnails in RSS feeds - Super Ginormous
  95. post_2 – de joaca
    post_2 – de joaca at |
  96. » Développement WordPress Wordpress 2.9 : la vignette d’un article en natif « Fairweb
  97. Eric S
    Eric S Published |

    I am trying to plug-in my own code to make the WP post thumbnails link themselves to the article.

    I already added in the archives pages and templates page the ability to do this.
    But on my single post page, I want that image to link to a full size.

    Right now I have only <a href="#" rel="nofollow"> and I am not sure what the tags are to pull those full size images in, any thoughts?
    Thanks

    Reply
  98. 10 NEW WordPress Wanted Hacks and Powerful Techniques - Huntsville Talk
  99. bbunker » T2010020501
    bbunker » T2010020501 at |
  100. Wendy
    Wendy Published |

    I like the code under ‘Changing the HTML output of the post image’. It automatically adds the title (alt post title) to an image. But I want to get rid of this…. :(

    It’s impossible :(

    Reply
  101. Easily add post thumbnails using native wordpress functionality in your theme | themesforge.com - Premium Wordpress Themes, News, TIps and More
  102. Peter
    Peter Published |

    Justin,

    Do you know if there is a way to add a rollover effect to post thumbnails?

    Reply
  103. Jeremy
    Jeremy Published |

    Justin,

    Is there a way to use the_post_thumbnail(); outside of the loop?

    Reply
  104. Margarida Fernandes
    Margarida Fernandes Published |

    I’m a newbie at this wordpress programming and I still can´t figure how to display my pages and subpages using this. All I see here is code for Posts not pages.
    I still don’t understand what it means to be ‘in the loop’. I am not a programmer. I am still begging to learn these things.
    Can anyone help me with the code for displaying subpages inside a page?

    Reply
  105. WordPress 2.9 is out! | WordPress | WereWP
    WordPress 2.9 is out! | WordPress | WereWP at |
  106. WordPress 2.9 Feature Overview: Jan 2010 Meetup | WordPress Asylum
  107. iPhoned.nl
    iPhoned.nl Published |

    Hi Justin, great tutorial. We will use the thumbnail feature within our new theme. Thx!

    Reply
  108. Bane
    Bane Published |

    Justin, I thought this might be useful to your readers.

    Next & Previous Post Titles With Thumbnails: http://wordpress.org/support/topic/368725

    Reply
  109. Enhance Your WordPress Post Thumbnails in 5 Minutes Using CSS | Junkstate of Design
  110. How To: Create a Sub-Loop in Thesis | Greg Rickaby dESIGN
  111. Dave
    Dave Published |

    Using the built-in wordpress thumbnail feature seems to add *many* extra queries when I used it in my loop. I think I’ll go back to my custom field solution.

    I use the debug queries plug-in from time to time, and I found out that my queries nearly doubled to 40-something after using the built-in thumbnail feature.

    Anyone uncover something similar to this?

    Reply
  112. Insel Hvar
    Insel Hvar Published |

    I especially like the feature with usage of default picture i am missing that part on my template.

    Reply
  113. Pragati Sureka
    Pragati Sureka Published |

    Thanks for amazing guide to wordpress thumbnails… specially “How to return the image instead of displaying it”.

    Reply
  114. gr33n
    gr33n Published |

    “Changing the HTML output of the post image
    In this example, I’ll show you how to wrap the image with a link to the post”

    using it and it is great … but i wonder if it is possible to limit this feature only to archive pages … or rather – to exclude single posts from it, since when image appears in single post there’s no need to link to same single post …

    Reply
  115. Križarjenje
    Križarjenje Published |

    Great post, and a lot of comments, congrats… :)

    Found how to return the image…

    greetings, Križarjenje

    Reply
  116. PHP-help » Enhance Your WordPress Post Thumbnails in 5 Minutes Using CSS
  117. Enhancing wordpress post thumbnails using css « Plus 2 Blog
  118. TOEIC
    TOEIC Published |

    Thank you for this great explanation. I has always many problems with images.

    Reply
  119. Javi A.
    Javi A. Published |

    Hi everybody !
    Thanks to the author for this hopeful article !!
    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 !

    Reply
  120. Nuevo en Wordpress 2.9: Miniaturas de Entrada (Post Thumbnails) | emenia.es
  121. TheLightRain » Blog Archive » Enhance Your WordPress Post Thumbnails in 5 Minutes Using CSS
  122. Sabuj kundu aka manchumahara
    Sabuj kundu aka manchumahara Published |

    I think after adding this line in my theme
    add_theme_support( ‘post-thumbnails’ ); I am getting attachment url in place of post url after uploading image and in popup image edit window. There is option for none, file url and post url but I am getting attachment url as post url …. my permalink is like /%year%/%monthnum%/%post_id%.html

    Any one got same problem ?

    Reply
  123. Solo
    Solo Published |

    hi all ..
    I have a problem. I write a post. Insert thumbnail and click on publish but that does not save the thumbnail. I have to write the post, publish it and THEN insert the thumbnail. Am I doing something wrong or is this the default behavior?

    Reply
  124. Sarang Walet
    Sarang Walet Published |

    Nice tutorial, The thumbnail looks good. thanks for sharing

    Reply
  125. Wordpress Plugins for the Media Library | DigitalAppleJuice
  126. Bobby
    Bobby Published |

    This has been very helpful.
    Thanks

    Reply
  127. Enhance Your WordPress Post Thumbnails in 5 Minutes Using CSS - Everything You Need - Basic Web Design
  128. Will Ashworth
    Will Ashworth Published |

    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:

    the_post_thumbnail(’some-special-size-here’);

    I have tried this as well but it still outputs the image tag with it…

    $image = get_the_post_thumbnail( $post->ID, ‘some-special-size-here’ );

    Reply
  129. Will Ashworth
    Will Ashworth Published |

    I found that parsing the URL out works, but it’d be great if Wordpress could add built-in functionality to grab just the URL instead of forcing us to use the IMG tag.

    http://polymathworkshop.com/shoptalk/2010/03/19/get-the_post_thumbnail-direct-path-for-wordpress/

    Reply
  130. Trisha
    Trisha Published |

    Any idea if this works 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 doesnt show.

    Any idea what I might be doing wrong?

    Reply
  131. Better Display Of Images In your WordPress Post Excerpts | Online Money Blog
  132. Enhance Your WordPress Post Thumbnails in 5 Minutes Using CSS | Web design news and tutorials
  133. Dan
    Dan Published |

    Wow…you saved light years of me trying to figure out these thing by myself.
    This post is GOLD…thank you for sharing :D

    Reply
  134. Bob
    Bob Published |

    How do you add lightbox or thickbox (example rel=”lightbox” or class=”thickbox”) to the thumbnail?

    Reply
  135. Rich
    Rich Published |

    Great stuff you had here. Those were really helpful tips for me although Wordpress 2.9 is an old version and there are new version for this. I am hoping it works with the latest version. The feature was very useful for beginners like me. Thank you.

    Reply
  136. Yahya Ayob
    Yahya Ayob Published |

    Hey Justin, I’m a fan of this add on support for uploading images.

    It works great for me but I tried something which I had no idea why.

    I set my user role as Contributors and when I try to click Set Thumbnail, nothing happens!

    Could you figure this out? Should I change the user role to Author?

    Look forward to hear from you, Justin. =)

    Reply
  137. Enhance Your WordPress Post Thumbnails in 5 Minutes Using CSS
  138. Dan
    Dan Published |

    I added the code under “Changing the HTML output of the post image” and it works great except the image title is the title of the image NOT the title of the post. If I mouse over the very bottom right of the image it has the post title but the rest of the image is the title tied to the image itself.

    Anyone have any ideas on how to fix this? Any way to trim the $html string off after “title=’ ” and add in the Post Title so that the image will have the correct data?

    Here is how the page source reads currently:

    Reply
    1. Reg Tait
      Reg Tait Published |

      Yeah, struggling with this bit too. You can always just change the title of the image as a workaround.

      Reply
  139. David
    David Published |

    These are really one of my big questions few months ago when I was still new with wordpress and I don’t know some features and uses of it. Until, I got into your site and you really have so many important lecture/ideas for beginners like me and everyday visit to your site provides me new ideas in improving what I really want to do in my life. Thank you.

    Reply
  140. Jason Pereira
    Jason Pereira Published |

    I must say you’ve created a very helpful source for beginners like me. Although I knew some part of it there are still facts and codes which I learned from you. Thanks a lot.

    Reply
  141. SS
    SS Published |

    Hi there.. thanks for the info..

    i’m wondering?? how do i get the ‘thumbnail’ to show up in this query??

    post_title; ?>
    post_content; ?>

    iv tried a few things but nothing seams to working
    Kindly

    Reply
  142. Magdy
    Magdy Published |

    Hi Justin, nice explanation!

    I have just one question, is there a way to remove the post thumbnail from the image gallery of the post?

    The reason I’m asking this is because all my posts have an image gallery and I don’t want to have the post thumbnail inside this gallery.

    Hope you can help me!
    Thanks

    Reply
    1. Magnus Cederholm
      Magnus Cederholm Published |

      I’m also wondering about this..

      Without this function this new feature is rather worthless since you could just have used thumbnailversions of an image as a thumbnail.

      Reply
  143. jeherve
    jeherve Published |

    I have got a question regarding this the_post_thumbnail I got it working, it is a great new feature, but I now face an issue when I want to add a new size of thumbnail.
    It works perfectly and creates a new thumbnail for all new posts, but it does not create a new thumbnail size for the old posts. How can I solve that issue?

    Thanks for your help!

    Reply
  144. Wordpress Yazı Resmi (Thumbnail) Özelliği
  145. Featured Image: WordPress’ Best Underused Feature
  146. Rasel
    Rasel Published |

    I tried , but i cannot get any effect of this modification in my site.

    Reply
  147. Yurckk
    Yurckk Published |

    Great posting on the image feature, I just noticed about it lol.

    Reply
  148. Toni L
    Toni L Published |

    How can I pull the image meta data for PHP?

    1) Let’s say I want to assign $width_of_the_image variable to check that image is under or over certain size.

    2) Then I can compare this size to my set values and give the image a proper class to handle the output nicely.

    Maybe a tutorial?

    Reply
    1. Toni L
      Toni L Published |

      Here is some nasty code that worked for me:

       image = get_the_post_thumbnail( $post->ID, 'single_post_thumbnail' );
      			  function getAttribute($attrib, $tag){
      				//get attribute from html tag
      			$re = '/' . preg_quote($attrib) . '=([\'"])?((?(1).+?|[^\s>]+))(?(1)\1)/is';
      			if (preg_match($re, $tag, $match)) {
      			return urldecode($match[2]);
      			}
      			return false;
      			}
      			$tag=$image;
      			$width = getAttribute('width', $tag);
      			$title = getAttribute('title', $tag);
      			$alt = getAttribute('alt', $tag);
      					if($width > 350) {
      					the_post_thumbnail('single_post_thumbnail');
      					}
      					else{
      						the_post_thumbnail('single_post_thumbnail', array('class' => 'alignleft'));
      						}
      					the_excerpt();
      					}  
      			
      				else{ the_excerpt();} ?>
      Reply
  149. Wordpress Plugins for the Media Library « madbadcat.org
  150. baa
    baa Published |

    Hi Justin,

    thanks, this article helped me a lot.

    Like Bob – April 26, 2010, i would also like to put a lightbox on the image.

    How do you apply the extension (.jpg or .png or.gif) to the image?

    Reply
  151. Raphael Essoo-Snowdon
    Raphael Essoo-Snowdon Published |

    Is there a way to set a SET size for these post thumbnails?

    Reply
  152. Tony Stark
    Tony Stark Published |

    Is there any plugin that does this work? There’s no thumbnail how ever i tried.

    Reply
  153. mark
    mark Published |

    Is there a way to pull the featured image URL for use in the head? Here is what I would like to do – Im trying to add something like this to the head of my single.php pages –

    <link rel="image_src" href="ID, 'thumbnail'); ?>" />

    However, this doesnt work. All I need is to point it to the URL. Any ideas? Thanks.

    Reply
  154. lv
    lv Published |

    Hey Hackadelic,

    I was thinking of some sort of anchor and “a” name situation. i have done this before with an accordion, but it was out side of wordpress.

    Regards
    fff
    Luke

    Reply
  155. James Tryon
    James Tryon Published |

    Im looking for a way to have two featured images.

    One for the thumb nail and a 2nd one for a Call to action slider im making.

    I would like my client to be able to upload an image just like the featured image works, and have two area on the left side for images.

    I have been googleing for hours ;c )

    I understand custom post types and taxonomies, i have written several plugins. Just looking for a push in the right direction.

    Thanks and great post.

    Reply
  156. Thorsten
    Thorsten Published |

    Hi Justin,

    Thanks for the great explanation. I am not an expert and therefore allow me one question.
    I would add some text to the title prior to the name of the picture. Something like:

    Click here to get to the picture ‘ + post_title + ‘

    What would I have to add to the function.php to achieve this?

    Thanks & Bests
    Thorsten

    Reply
  157. Trevor Maskery
    Trevor Maskery Published |

    is there anyway of using this to just produce the url for the featured image?
    i need to use the the featured images twice one in a thumbnail with a seperate style and an alignment to the one on the post.

    is there a way of extracting the image location from the ID?
    was a little confused by the html editing section of this post :S

    Reply
  158. Michelle
    Michelle Published |

    Hi Justin, hoping you can point me in the right direction for a problem I’m having.

    I’m using the plugin on a site that requires transparent thumbnails due to the design. I’ve tried Gif and PNG files, and the thumbnails lose the transparency and show up as black. I’ve searched for a solution online, but have not been able to find one.

    Hoping you might now the fix?

    Thanks

    Reply
  159. Michelle
    Michelle Published |

    Hi Justin, found the solution to my problem, so posted again in case others have the same issue. I discovered the PNG files have to be saved as 24bit – the resolves the black background.

    Reply
  160. WordPress Post Thumbnail Revisit « WP LOGBOOK
  161. Dallas Moore
    Dallas Moore Published |

    That was ALMOST everything I needed to know about the post image feature. :) Now I just need to know if I can change the alt tag for the image. I’ve seen people that say I can’t, but I don’t like that word. I’ve also seen the codex page for the_post_thumbnail and the default attribute Wordpress assigns to it. Can I somehow use this information to change it?

    Your response is GREATLY appreciated.

    Dallas

    Reply
  162. Kwame Busia
    Kwame Busia Published |

    Fantastic post, that was really really useful. Thanks alot – now I know my way around adding featured post thumbnails!

    Reply
  163. Ivan Lee
    Ivan Lee Published |

    great post, its was what i need for my WP website. thanks very much and now i know how to adding post thumbnails…..!

    Reply
  164. Stepan
    Stepan Published |

    Thanks a lot for clear instructions. Now I will use thumbnails at archive pages :)

    Reply
  165. WordCast 75: WordPress 2.9 and Beyond | WordCast Podcast
  166. Alain
    Alain Published |

    Hey, thanks for the info.

    -But, how do i get an image to resize, only to fit its smallest side in the box? (thus, fitting inside but cropping a little it’s larger side)…

    Sort of the reverse of hard crop.

    Thanks.

    Reply
  167. Kristijonas » Archive » Naujas tinklaraštis
  168. Michael
    Michael Published |

    Hi Justin,

    In my search to find out how can I fix my problem, I found your site. I’m just starting to layout my site and I came across some issues. Under my archives menu, I made a few sub-menus linking to some of my test post. When you click on any of the sub-menu. It only displays some on my text and none of my photos. You have to click again on the heading of the post to display the entire post. Is their a way to display my entire post with images, as soon as I click on the sub-menu links. Here is a sample of a site who does just what I want to do http://www.munroephotography.com/blog/

    Thanking You In Advance!

    -Mike

    Reply
  169. Christian Sisson
    Christian Sisson Published |

    Perfect!!!!!!!!!!!!!!!!!!!

    Thank you a thousand time :)

    Happy new year!

    Reply
  170. erdem tasarhane
    erdem tasarhane Published |

    thanks for the detailed explanation…

    Reply
  171. Jeff Meadows
    Jeff Meadows Published |

    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.

    Reply
    1. Mike Targett
      Mike Targett Published |

      Ever get a response about this?

      Reply
  172. Mads ny
    Mads ny Published |

    Hi guy’s
    i spend some time to figure out how to show featured images from PAGES within a loop, where it seems you have to use get_the_post_thumbnail instead, here’s what i found if anyone should be puzzeling with the same issue. :)

    60,
    	        'post_type'   => 'page',
    	        'post_status' => 'publish'
    	    )
    	);
    	if ( $latest_content->have_posts() )
    	{
    	    while ( $latest_content->have_posts() )
    	    {
    	        $post = $latest_content->next_post();
    	
    	        // Do anything you know about the loop.
    			if(get_the_post_thumbnail($post->ID)){
    			?>
    
    				<a href=""> ID); ?> </a>
    Reply
  173. Frank
    Frank Published |

    Hi Justin,
    Thanks for guide to wordpress thumbnails…
    Regards Frank

    Reply
  174. Woking With Featured Image in WordPress - VoodooPress
  175. Mathias Rangel Wulff
    Mathias Rangel Wulff Published |

    If you must have an image on “home” (as autofokus) place this in your functions.php

    function echo_cover_image_url($post_ID, $size='large'){
    	$imgData = wp_get_attachment_image_src(get_post_thumbnail_id ( $post_ID ), $size);
    	$imgUrl = '';
    	if(is_array($imgData)){
    		echo $imgData[0]; //featured image
    	} else {
    		the_post_image_url($size);	//fall back on last uploaded image
    	}
    }

    and call echo_cover_image_url(get_the_ID(), 'large') from the loop.

    Reply
  176. Harpreet Grover
    Harpreet Grover Published |

    Reg: get_post_thumbnail_id()

    Hi Justin,

    I want to display an image only if set through featured image. Esle, diaply nothing.
    But it takes an image from the post to display there.

    Is there any other method.?

    Reply
  177. Mark "Chief Alchemist" Simchock

    Thanks for getting me started with WordPress and images, Justin.

    I’ve since tossed together a primer on WordPress and images. It’s not as thorough as your article but I think some might find it helpful.

    http://www.chiefalchemist.com/primer-wordpress-and-working-with-images/

    Let me know what you think. Maybe I should present it a bit differently?

    Reply
  178. Image sizes in WordPress
    Image sizes in WordPress at |
  179. bren
    bren Published |

    Brilliant script – just love it! Thank you.

    One tiny problem, though.

    The script is set to call thumbnails and my WP media is set for thumbnails to be sized to width =150.

    My photos uploaded are already sized at 150, BUT your script is pulling the photos to 213 so everything is distorted.

    Any suggestions – thx again for the wonderful script.

    Reply
  180. Martin
    Martin Published |

    The idea is to click on a featured image and go to an external website as set in the image link box..!

    Reply
  181. kyle
    kyle Published |

    […] Everything you need to know about WordPress 2.9′s post image feature […]

    Reply
  182. Holger Voss
    Holger Voss Published |

    Brilliant! Absolutely brilliant! Good explanation also for germans! Thanks a lot for that!

    Reply
  183. read me | | Find a NannyFind a Nanny
    read me | | Find a NannyFind a Nanny at |
  184. Stephen Crane
    Stephen Crane Published |

    So, I can’t get the “Post Thumbnail box” to appear in my theme. I placed the code :

    add_theme_support( 'post-thumbnails' );

    into my theme’s function.php file but it won’t show up in my posts panel. What am i doing wrong?

    Reply
  185. Características de la revista escolar online | Curso de WordPress 2012
  186. Introduction to WordPress Homework – Class 13 – Theme Customization and Child Themes | Learning from Lorelle
  187. WordPress Images ~ The Right Way - NICHMARKET
  188. Vikas
    Vikas Published |

    Hi Justin,

    I am in a situation,

    I have created a function that would generate a custom image using

    add_image_size('thumbnail-cs', 280, 210, $crop);

    It works fine and is generating an image everytime I am uploading an image.

    My problem arises when I try to fetch this generated image. I am using following code:

    the_post_thumbnail('thumbnail-cs', array('class'=>'frontslide'));

    Instead of fetching the image generated, its fetching the default thumbnail size. Can you please tell me what I am doing wrong?

    Reply
  189. Geoffrey Hale
    Geoffrey Hale Published |

    This is brilliant. Thanks so much for the help. I’m implementing this right now at my new group project at http://www.futebolbrasileirao.com and will get around to it soon at my own project at http://www.halecollege.com. Thanks again mate!

    Reply
  190. Aaron
    Aaron Published |

    Hello, I have noticed other people asking about lightbox and you have yet to respond. Maybe I can refresh the thought. I am trying to use lightbox with my post thumbnails. Is there anyway to pull just the images source for the lightbox feature? If I add the “get-thumbnail” call to the source for the large image it processes all the html from the call. Here is an example…

    <a href="" class="thumbnail" rel="lightbox[gallery]">
                 ID, 'thumbnail'); ?>
                </a>

    Basically, I need to know what to put in the “href” section to give me the thumbnails url.

    Reply
  191. 如何使用WordPress 2.9内置文章缩略图功能(Post Thumbnail) - 中文吧
  192. 如何使用WordPress内置文章缩略图功能 | JTBlog
  193. Ricky1990
    Ricky1990 Published |

    Hi,
    Thanks for this tutorial. I’ve download “get the image” plugin for WP and done it :)

    Reply
  194. WordPress Yazı Resmi (Thumbnail) Özelliği | Murat Son
  195. WordPress Yazı Resmi (Thumbnail) Özelliği | Gelimeler
  196. WordPress Yazı Resmi (Thumbnail) Özelliği | Dopamin Bilisim Blog
  197. sascogroup.it @ seo freelance

    Great post, wonderful article, i think you write important things for me and for lots of people.

    Great Justin don’t stop your work!

    Alex (From Italy)

    Reply
  198. WordPress函数参考:get_the_post_thumbnail – Kraddy WordPress
  199. Hello world! | Workspace English
    Hello world! | Workspace English at |
  200. WordPress函数参考:get_the_post_thumbnail | WPFarmer
  201. esercizio di stile su testo e immagini croppate a 1200 - CKN Studios di Matteo Graser

Leave a Reply

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution.

Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.

css.php