— Patrick Galbraith

Default Thumbnail Plus (WordPress Plugin)

Automatically display a default Post Thumbnail image, either the first image attached to a post, or set default images for specific categories, tags, or custom taxonomies. Supports custom fields to ease upgrading.

Download: http://wordpress.org/extend/plugins/default-thumbnail-plus




 
 

Thumbnail Selection Hierarchy

The hierarchy below determines what thumbnail will be chosen, in other words the plugin first checks if the user has manually set a featured image. If not then it checks if it has a custom field containing an attachment id, and so on. Once the plugin gets to the last step if no default thumbnail image is set then no post thumbnail will be displayed.

  1. Featured Image
  2. Custom Field
  3. Image Attachment
  4. Embedded image
  5. Embedded video
  6. Category/Tag/Taxonomy Thumbnail
  7. Default Thumbnail

Add Filter (Category/Tag/Taxonomy Thumbnail)

You can add filters which allow you to select a thumbnail for a specific category, tag, or custom taxonomy. The value field is required and must contain either a comma separated list of slug, id, or title for a existing category, tag, or custom taxonomy. Any post that does not have a post-thumbnail set and has the specified tag, or is a member of the category or taxonomy will show the default thumbnail specified.

Use image attachment if available

Automatically use the post's first available image attachment for the thumbnail. This is useful for older posts that haven't got a featured image set.

Custom Field

Enter a custom field key here, it's value if set will become the default post thumbnail for that post. The custom field value can either be an Attachment ID, or a link to an image.

Note: If the custom field value contains a link to an image it will output a simple image tag and attempt to populate the width and height attributes. However the aspect ratio may not match other thumbnails. The plugin does not check if the image exists or is of valid type or size.

Use embedded image if available

Automatically use the post's first available embedded image for the thumbnail. This is useful if you embed external images.

Note: This option does not work with has_post_thumbnail() or get_post_thumbnail_id(). If the "cache external images" option is set then the plugin will automatically resize, crop the image and store a local copy.

Use embedded video if available

Automatically use the post's first available embedded video for the thumbnail (YouTube only).

Note: This option does not work with has_post_thumbnail() or get_post_thumbnail_id(). If the "cache external images" option is set then the plugin will automatically resize, crop the image and store a local copy.

Excluded posts

List of posts to be ignored by this plugin. Comma separated e.g. 10, 2, 7, 14.

Note: These posts may still display a thumbnail if one has been set manually (using the "Set featured image" button on the post page).

Functions

The following functions work to directly return post thumbnail even if the plugin hooks have been disabled. This allows you to disable the filters and call the plugin manually. This should only be used if you are creating a custom theme and can ensure that DefaultThumbnailPlus is installed.

dpt_post_thumbnail_id($post_id, $size = null, $attr = '')
Returns the post thumbnail ID. Doesn't work with embedded images.

dpt_post_thumbnail_html($post_id, $size = null, $attr = '')
Directly calls the default post thumbnail function. Works the same as calling get_the_post_thumbnail().

dpt_post_thumbnail_src($post_id, $size = null)
Returns href to post thumbnail image.

 


 

Why can't I see any thumbnails with my custom theme?

A number of themes use has_post_thumbnail() to check if a post thumbnail exists before calling the_post_thumbnail() to display the thumbnail. The problem with this is that thumbnails that are linked to directly (either external images or video thumbnails) won't return correctly for this check and therefore may not show.
 
To fix this issue you will need to look for the following code in your theme:

if(has_post_thumbnail()) {
    the_post_thumbnail(...);
}

 
And simply remove the call to has_post_thumbnail() so you are left with this:

the_post_thumbnail(...);

 

TwentyEleven

The header only works with image attachments, i.e. embedded images/video thumbnails won't show.

The header attachment width also has to be greater than the custom-header width option (default 1000px). This is generally a good thing though since it prevents low resolution images from displaying in the header.

 

WooThemes

WooThemes call a function called woo_image() rather than using the default WordPress functionality. This causes the default post thumbnail to never show.

So to fix this you need to override the woo_image() function with a custom implementation that reverts to using WordPress's in-built functions. To do this paste the following code into the TOP of the themes functions.php file found in /wp-content/themes/your_themes_name after the opening <?php tag.


//Override the default woothemes image function and revert to using the default wordpress function.
if ( ! is_admin() && ! function_exists('woo_image')){
    function woo_image($args) {
        global $post;

        $size = null;
        $attr = array();
        $before = '';
        $after = '';
        $class = '';

        if ( !is_array($args) )
            parse_str( $args, $args );

        extract($args);

        if(empty($id))
            $id = $post->ID;

        if(isset($width) && isset($height))
            $size = array($width, $height);

        $attr['class'] = 'woo-image '.$class;

        if(isset($alt))
            $attr['alt'] = $alt;

        $output = $before . get_the_post_thumbnail($id, $size, $attr) . $after;

        if($return == TRUE)
            return $output;
        else
            echo $output;
    }
}

 
The downside is that it won't recreate all of woo_image()'s features. However it shouldn't cause issues with most themes.

Related Posts

107 comments
  1. Eye of Siva says: January 4, 20122:56 am

    I was very interested in this plugin as it was trying to do exactly what I was trying to do, namely to get post thumbnails on the basis of image attachment or a default. The plugin does not recognize images that are linked to an external site (e.g. flickr.com). So even if there is an image present, the plugin chooses the default image. Could you help in this regard please? I am an absolute newbie in php.

  2. jonathan says: February 3, 20125:10 am

    Any hints on how to get this to work with arras theme? Looks snappy really want to use it, but for some reason its having zero effect on my blog.

    • Patrick says: February 3, 201211:03 am

      Because that theme has its own custom get_thumbnail function you will need to modify the theme to make it work.
       
      In the file arras/library/thumbnail.php change the arras_get_thumbnail() function on line 73 to this:
       

      function arras_get_thumbnail($size = 'thumbnail', $id = NULL) {
      	global $post, $arras_image_sizes;
              
              if ($post) $id = $post->ID;
      
              return get_the_post_thumbnail( $id, $size, array(
      				'alt' 	=> get_the_excerpt(), 
      				'title' => get_the_title()
      			) );
      
      }
  3. jonathan says: February 6, 20129:42 am

    Sweet! Looks like that solution is working like a charm. I'll let you know if anything ends up being broken - but so far, nope!

    • Patrick says: February 7, 201211:04 am

      Glad it is working just remember if you update the theme you will need to re-apply the fix.

  4. Erik says: February 8, 20122:48 pm

    Great plugin and I have it working on one site, but on another site I have running a different theme (Instinct - http://newwpthemes.com/instinct-free-wordpress-theme/) it doesn't work. I imagine there is a coding change like the one above to fix it but I'm not handy with coding to be able to fix it. Any ideas?

    • Patrick says: February 13, 201210:14 am

      The problem with that theme is that it checks if the post has a thumbnail before displaying it using the has_post_thumbnail() function. Since the post technically doesn't have a thumbnail set nothing will show. You can fix it by modifing the theme files (post.php, post-single.php, etc...) and change this:
       

                 if(has_post_thumbnail())  {
                      the_post_thumbnail(
                          array($theme->get_option('featured_image_width_single'), $theme->get_option('featured_image_height_single')),
                          array("class" => $theme->get_option('featured_image_position_single') . " featured_image")
                      );
                  }

       
      Basically just remove the if statement that checks has_post_thumbnail(), so it becomes this:
       

                      the_post_thumbnail(
                          array($theme->get_option('featured_image_width_single'), $theme->get_option('featured_image_height_single')),
                          array("class" => $theme->get_option('featured_image_position_single') . " featured_image")
                      );
  5. Aaron Harquenin says: February 14, 201210:34 pm

    Hi

    Ive created a theme from scratch and its fairly clean and basic. When i install your plugin it works on the admin panel but i cannot see the result being rendered in the site face.

    can you please help me?

    Thank you

    • Patrick says: February 15, 20124:13 pm

      Hi Aaron,
       
      Make sure you aren't calling has_post_thumbnail() before the displaying the thumbnail since has_post_thumbnail() will return false.
       
      if(has_post_thumbnail()) {
      the_post_thumbnail(...

       
      Otherwise there isn't much I can do unless you send me your theme's files.

  6. Kalynbm says: February 22, 20123:56 pm

    Patrick hey, this is the plugin that I've been looking high and low for, but I couldn't get it to work with the theme that I'm currently using, the theme's name is Mingle. I hope you can point me to the problem, and thanks in advance. :)

  7. jonathan says: February 22, 20129:21 pm

    My problem is the selected default image does not show and when clicked on to show the image gets a 500 error, the image folder is in the plugin folder and has a default in it but that doesn't show either... what am i doing wrong

    • Patrick says: February 23, 20129:59 am

      Hi Jonathan,
       
      It sounds like a theme related issue can you tell me what theme you are using or if it a paid theme can you post the code from the theme that calls the_post_thumbnail(...).

  8. Kalynbm says: February 22, 20129:54 pm

    Hey Patrick,

    I swore I hit submitted, but I guess the comment didn't show up. So here I go again...lol. So I've been searching high and low for a plugin like this one, and I'm glad that I found it, but the problem is that I can't get it to work on my theme, the theme's name is Mingle. I have tried using ID, slugs and title for the value but it still doesn't show up. :( Can you point me to the problem? And thanks in advanced. :)

    • Patrick says: February 23, 20129:57 am

      Hi Kalybm,
       
      Your comments weren't shown because it was flagged as spam by Akismet.
       
      I can't give you specific advice because your theme is a paid one (and I can't get access to the source).
      Make sure the theme isn't calling has_post_thumbnail() before the displaying the thumbnail since has_post_thumbnail() will return false.
       
      if(has_post_thumbnail()) {
      the_post_thumbnail(...

       
      Unfortunately I can't override the has_post_thumbnail() check since WordPress doesn't provide that option to plugin developers.

  9. Doug says: February 25, 201211:52 am

    Hey, great plugin! When a post has an attachment that is not an image (e.g., a PDF file), no thumbnail is shown.

  10. Kermit Woodall says: February 26, 20124:32 am

    I'm trying out your plugin on our site but it's not working quite like I expect. It seems to pull images from elsewhere on the page that the post appears on.

    http://test.advocatemag.com/category/blog-post/

    I'm calling the post thumbnails in the Facebook Like button (search the source for fblike) and if you look down the the post for "Crime alert: Police seek help identifying aggravated roberry suspects " it's pulling the image of the author shown on the sidebar. Similar issues elsewhere.

    On a post that has no thumbnail, because it's a video, ("Advocate video: Tiramisu Restaurant ") it actually pulls a thumbnail from the code that generates the grids of video thumbnails below.

    Any ideas?

    Thanks!

    Kermit Woodall

  11. Kermit Woodall says: February 26, 20124:35 am

    Correction... the video post DOES have a featured image thumbnail and there's something wrong in my code. Hang on while I diagnose this before you waste your time. I think I'm calling the wrong function for showing post thumbnail.

    Kermit Woodall

  12. Kermit Woodall says: February 26, 201210:27 am

    Ok...I did have some bad code in there but have fixed that. Now I'm just not getting any result from using the plugin. No fallback to a default thumbnail and no finding the first image.

    http://test.advocatemag.com/category/blog-post/

    This code, below, is what I use to get the thumbnail link.

    Kermit Woodall

  13. Kermit Woodall says: February 27, 20127:03 am

    `
    <span class='st_fblike_hcount' st_url='' st_title='
    ' st_image='
    ' st_summary='
    ' displayText='share'>

    `

  14. Kermit Woodall says: February 27, 20127:04 am

    [code]

    <span class='st_fblike_hcount' st_url='' st_title='
    ' st_image='
    ' st_summary='
    ' displayText='share'>

    [/code]

  15. Kermit Woodall says: February 27, 20127:07 am

    Sorry...I'm trying to get the code to show up here and none of the tags seems to work here.

    $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
    echo $large_image_url[0];

    I've tried just the PHP code w/out any tags to see if this will work.

    Kermit Woodall
    http://kermitwoodall.com

  16. Eye of Siva says: March 11, 20121:56 pm

    Hi. I had requested earlier if the plugin will pull in thumbnails even if the image linked in the post is from an external site like flickr/picasa. Currently even if there is an image link, the default image is used as thumbnail. Is there any code I can change to get this working, please.

  17. Liliz says: March 12, 20128:20 pm

    Hi, i am trying to make the plugin work with the Evolution theme which has a piece of code like this in the home template:

    Following your suggestions above i removed the "if" statement. This gives a partial result: empty boxes are showing next to the posts, but i cannot see the images that i assigned with the plugin. Do you have any hint about this?

    • Patrick says: March 18, 20128:38 pm

      Hi Lilliz,
      Can you paste the code example to http://pastebin.com/ and post the link because WordPress stripped all your code from the comment.

  18. Anthony Navarro says: March 24, 20124:52 am

    Hi there... I was using your plugin to see if it would work for one of my clients and I ran into a problem with the Builder theme engine from iThemes. It's a known problem on their end. Quote:

    Problem: Any time Builder's editors show a Thickbox dialog (delete confirmation, module editors, etc), the dialog will be broken and appear as an empty white box that flows into the top of the browser window.
    Cause: The plugin enqueues WordPress' built-in media-upload script on all admin pages (not just its own). Since the media-upload script modifies all uses of Thickbox (also built into WordPress), this causes the Thickboxes in Builder to be broken.

    Is this a known issue that can be taken care of in an update?

    Thanks!

    -Anthony Navarro
    http://thewpdojo.com

    • Patrick says: March 30, 20129:06 pm

      Hi Anthony,
      It sounds like the plugin you are using is incorrectly enqueueing scripts outside its own page which is causing issues.
      I don't think there isn't much I can do to fix that.

  19. Kevin Van Lierop says: March 29, 201212:06 am

    Hey Hey.

    I think I've struck gold with your plugin. I think it is what I've always been trying to do but never could find an eloquent way to implement it.

    I'm having troubles though integrating it with a widget I have.

    Essentially what the widget does is display recent posts and you have the option to display them with or without thumbnails. If you choose 'with' it pulls the featured image if there is one, otherwise it simply shows a blank spot where the image should be.

    The site I am building will be used by people who do either do not want to be bothered to upload an image for each post or won't remember how and thus I'd love to have default thumbnail images to be able to use.

    The code for the widget can be found here: http://pastebin.com/dTXMnzxa

    But the piece of code that I think I'm having trouble with can be found here: http://pastebin.com/rUaidSAd

    I've tried removing the "&& has_post_thumbnail" portion, so it isn't validating against whether or not the post has a thumbnail, which is obviously doesn't, but still can't get it to work.

    I didn't know if "get_the_post_thumbnail" was the right function to be using, or if it is because no category information is being passed to the widget function.

    I know this is a very specific question but I'll most definitely donate to the plugin (and you) if I can get it working.

    Any help would be appreciated, but if it isn't possible I understand.

  20. Kevin Van Lierop says: March 29, 201212:07 am

    oh, not that it matters, but so you can see how it is visualized, this is the theme that I've used as a base for what I am doing: http://studiomw.co.uk/demo/ecclesia/

  21. Kevin Van Lierop says: March 29, 20124:58 am

    Turns out I can't seem to pull the images anywhere in my theme, even just in an individual post.

    I must be an idiot.

    • Patrick says: March 30, 20128:49 pm

      Hi Kevin,
      Didn't get notified about your comment for some reason :(
      Have you worked out the issue? Let me know if you have any problems with the plugin.
      Patrick

    • Patrick says: March 30, 20129:12 pm

      Also Kevin have you had a look at my other plugin Recent Posts Plus http://www.pjgalbraith.com/2011/08/recent-posts-plus/ I built it to work with Default Thumbnails Plus and it may help you with your recent posts widget.

  22. Kevin Van Lierop says: March 30, 201210:06 pm

    Patrick.

    Thanks for the reply.

    Once I got your message this morning I decided to play around more.

    I didn't know that plugin existed but have bookmarked it for future use when I have a site that doesn't have a similar function already.

    I realized that what was happening is that the Default Thumbnail plugin wasn't liking the category slug, so I tried using the cat id and that didn't work either, what did end up working was the actual cat name, which I never thought to try as typically it doesn't work and the others do.

    Anywho, I got it working by calling get_the_post_thumbnail so all is good.

    I'll donate a bit when my next payment comes in from my client for this work.

    Cheers,

    Kevin

  23. Dayna says: April 19, 20121:12 am

    Thanks for the great plugin! Finally got it working.

    Is it possible to extract thumbnails from externally linked images? Some of my posts contains all photos from Flickr and non uploaded directly into the Media Library. :(

  24. Karen de Lange says: May 31, 20128:50 pm

    Hi Patrick, thanks for designing this plugin, it's exactly what I've been looking for! I'm having some difficulty making it work with Suffusion theme, though - any help you can give me would be hugely appreciated. Thanks in advance.

  25. Suggymoto says: June 2, 20123:20 am

    Thank You!!!
    I've been looking for a plugin that did this since FOREVER!

    Didn't work straight away for me on my custom theme, but your advice above was spot on about "if(has_post_thumbnail()) {"

    Again, thanks!

  26. Rory says: June 15, 201211:59 pm

    Hi great plugin, just one question as it doesn't seem to work down the category hierarchy ie I would like to set a default thumbnail for a parent category and have all the children inherit that thumbnail too. Is this possible, or could each filter at least accept a comma separated list of slug/ids etc to save creating a filter for each parent and one for each of the children too? Cheers.

  27. Rory says: June 16, 20124:37 am

    Also, next question I have just realised I am using the post_thumbnail in certain situations to create a background image. Any idea how I can get the url of the default thumbnail your plugin uses rather than the call to get_post_thumbnail, am currently using wp_get_attachment_image_src for the ones that do have a thumbnail set. Cheers (x2!)

    • Patrick says: June 16, 20121:17 pm

      Hi Rory,
       
      The answer to your first question is that it uses the is_object_in_term function to check the category or tag I can't remember if this function supports checking up the hierarchy (it probably doesn't). See http://codex.wordpress.org/Function_Reference/is_object_in_term. I will add the option to add a comma separated list in the next update.
       
      At the moment you can only call get_post_thumbnail() which returns an image tag I assume you want to get the src of the image that is returned I will add a function for that as well in the next update.
       
      Patrick

    • Patrick says: June 16, 20122:36 pm

      Ok check out the latest dev snapshot I have implemented the changes listed above https://github.com/patrickgalbraith/Default-Thumbnail-Plus/zipball/master

  28. John Arcadian says: July 18, 20122:05 pm

    Comment

    Patrick, this is an awesome plugin. Thank you very much. It saved me the work of coding something similar (but much, much, much less polished) to get category images.

    I do have a question/suggestion for future releases. I've got one category that gets lots of posts on my site (http://www.gnomestew.com). For that category, we've got many images to use. If the plugin randomly selected (or selected from the images in order) from multiple images with the same category listing, that would be an amazing feature. I'm not sure how much utility it would have to most people, but it is a thought.

    Once again, thank you for the already incredible plugin!

    - JOhn

  29. Mark says: August 5, 20122:57 am

    Patrick, multi-image patch by Phuc PN is working properly! Can you add this feature in your plugin?

  30. pleasespamjosh says: August 18, 20125:57 am

    Thank you for the plugin. I'm using TheCotton Theme by Pexeto. I believe that something in the theme is preventing it from allowing the plugin to work properly. It recognizes a featured image properly, but without that...nada. I'm hoping to pull the thumb

  31. Paul Simbeck-Hampson says: August 30, 201211:08 pm

    Great looking plugin, Patrick, but it looks like I have the same issue as others. I've added an image for 'no image' and one for a category, neither are showing. Can you advise what part of the theme I need to change to make it work. Happy to donate too :)

  32. Paul Simbeck-Hampson says: August 31, 20123:07 am

    Update: No assistance required now. Regards...

  33. Paul Simbeck-Hampson says: August 31, 20123:08 am

    Update: No assistance required now, regards...

  34. R Op says: September 2, 201212:16 am

    Very exciting plugin. It will solve a slew of issues if I can get it going!

    Can i get some help with the immersion theme? http://pixelthemes.net/immersion/

    I've located all instances of has_post_thumbnail (content.php, content-image.php, includes/content-.php, & includes/content-image.php) and removed the if statement and can't seem to affect a change.

    • Patrick says: September 2, 201210:37 pm

      Hi R Op,
      Sorry there isn't really anything I can do since that is a paid theme and I can't get access to the source code.

  35. Andrey says: September 2, 201211:38 pm

    Hi Patrick, I doesn't work with 2011 theme.

    • Patrick says: September 4, 201212:07 am

      Hi Andrey,
      Can you let me know what the issue is?
      I only found one small bug but that is fairly minor. The images show up fine for me on my test server.
      Patrick

  36. Peter says: September 3, 20125:29 pm

    Patrick, your plugin doesn't work with the Twenty Eleven theme.

    • Patrick says: September 4, 201212:07 am

      Hi Peter,
      Can you let me know what the issue is?
      I only found one small bug but that is fairly minor. The images show up fine for me on my test server.
      Patrick

  37. Kermit Woodall says: September 4, 20123:26 am

    I would like to use your plugin but find it's not working on the responsive themes I'm using. They don't post_thumbnail but instead use get_post_thumbnail_id ... would it be possible for your plugin to support that as well?

  38. Kermit Woodall says: September 5, 201212:54 am

    Patrick,

    It seems to work well, except, that if there is an actual Featured Image already set it still overrides that.

    All the posts referenced in the slideshow at the top of this page have a featured image set.

    http://newsite.advocatemag.com/

    Kermit Woodall

  39. Kermit Woodall says: September 5, 201212:58 am

    Oops! Found one more bug. I cannot 'Select Image' when I try to change the default thumbnail in the settings for DTP. I can click that button all I want but nothing results.

    Kermit Woodall

  40. Andrey says: September 5, 20123:25 am

    Hi Patrick,

    My 2011 theme doesn't show thumbnails at all. Also I tried to upload standard thumbnail for the case when a post doesn't have pics, it doesn't receive this thumbnail.

  41. Debbie says: September 6, 201212:26 am

    Hey Patrick,

    Your plugin looks perfect for my site where I have a bunch of old posts and new posts in a category that won't have featured images.

    But I can't get it to work with my theme, even after deleting the has_post_thumbnail() check. Here's the code for a search results page. Any suggestions?

    http://pastebin.com/RqteuXHv

  42. Debbie says: September 6, 20123:08 am

    Thanks Patrick. Just installed and it works! I'll let you know if I discover anything wonky.

  43. GourmeSY says: September 6, 20125:19 pm

    Hi.
    Thank you very much for making this plugin!! It's really cool!
    Usually I only copy the images in Word doc. and then paste them on WordPress...
    Do you know if there is anyway that I can make thumbnails for the first image I "paste" on every posts?
    Thanks again!

    • Patrick says: September 10, 20122:13 pm

      Hi GourmeSY,
      Can you update to 1.0.2.2. The new version has a option called "Use embedded images if available" which you should enable and should fix your issue.

  44. GourmeSY says: September 10, 20126:03 pm

    Thanks! I tried that but it doesn't work....
    I'm not sure whether the images i used are embedded or not.
    I have a second blog on other website. After I finished a post, I copy the entire post and paste it on WordPress.
    When people click on the image, it brings them straight to my second blog.

    • Patrick says: September 10, 20126:16 pm

      Could you send me a link to the blog.
      Also let me know what theme you are using since not every theme supports that option.

  45. GourmeSY says: September 10, 20126:41 pm

    My website is http://gourmesy.erufa.com/
    and I am using "Glossy Stylo".
    Thank you!!

    • Patrick says: September 11, 201210:39 am

      Hi GourmeSY,
      What plugin are you using to display "Related posts"?
       
      Also the food on your blog looks really tasty

  46. Andrey says: September 10, 20129:23 pm

    Hi Patrick,

    I can't still save default thumbnail with your new version(2011 theme).

    • Patrick says: September 11, 201210:40 am

      Hi Andrey,
      Can you link me to your blog so I can see the issue.
      Thanks

  47. GourmeSY says: September 11, 201210:42 am

    I'm using "Related Posts Thumbnails".
    Thank you!! Heheee:DD

    • Patrick says: September 11, 201211:08 am

      Hi GourmeSY,
      Unfortunately that plugin uses a method called get_post_thumbnail_id() which doesn't work with embedded thumbnails.
       
      See my comment below for fix

    • Patrick says: September 11, 201211:09 am

      Oops made a mistake see updated code below.

  48. GourmeSY says: September 11, 201211:41 am

    I tried $image = dpt_post_thumbnail_src( $post->ID, $poststhname );
    doesn't work...><~

    • Patrick says: September 11, 201212:06 pm

      Hi GourmeSY,
      Sorry here is the updated version:
       
      Replace this on line 254:
       

      if ( current_theme_supports( 'post-thumbnails' ) ) { // using built in WordPress feature
          $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
          $debug .= 'Post-thumbnails enabled in theme;';
          if ( !( empty( $post_thumbnail_id ) || $post_thumbnail_id === false ) ) { // post has thumbnail
              $debug .= 'Post has thumbnail '.$post_thumbnail_id.';';
              $debug .= 'Postthname: '.$poststhname.';';
              $image = wp_get_attachment_image_src( $post_thumbnail_id, $poststhname );
              $url = $image[0];
              $from_post_body = false;
          }
          else
              $debug .= 'Post has no thumbnail;';
      }

       
      With this:
       

      if ( current_theme_supports( 'post-thumbnails' ) ) { // using built in WordPress feature
          $debug .= 'Post-thumbnails enabled in theme;';
          $image = dpt_post_thumbnail_src( $post->ID, array($width, $height) );
          $url = $image;
          $from_post_body = false;
      }

       

  49. GourmeSY says: September 11, 201212:40 pm

    Thanks a lot, Patrick!!!!!!!
    It works like magic!!! Thank you very much for your help and patience.
    I really really appreciate it!! >3<

    • Patrick says: September 11, 201212:46 pm

      No problem.
      Make sure you upgrade the plugin to 1.0.2.3 when it becomes available since I found a small bug that may cause some images to show as white the first time they are loaded (however it works once page is reloaded so it's not a big issue).

  50. GourmeSY says: September 11, 20121:16 pm

    Got that!
    Thanks! It's really a great plugin!

  51. AMedd says: September 12, 201211:42 am
  52. Victoria says: September 28, 20121:00 am

    Hello, I really love this plugin and would save me trouble but I am having one major issue. Everytime I try to upload an image...once it is done uploading and crunching...when it comes to saving the image (or should I say clicking the button that says enter post) I click on the button and then it shows me a blank white box. I have tried repeatedly and don't know why this is happening. Thanks ....I am using FashionNLifestyle designed by BGlam, Fashion Themes and made free by Womens Perfume(that's what it says on the footer).

  53. Atze says: October 12, 20122:19 am

    Unfortunately this doesn´t work, when I use a thumbnail from Next Gen Gallery Plugin for my posts ...

  54. Pete says: October 16, 20124:58 am

    I'm using woothemes n it doesn't work

  55. Easton says: October 16, 20127:54 am

    Hi there - thanks for working on the plugin. My question is... is the plugin supposed to work with "Page" as well as "Post"?
    I'd love to be able to add default image to my pages.

    Thanks!

  56. John Phung says: November 4, 201211:57 pm

    Hello,

    The plugin is not resizing the video thumbnail properly for me or creating a local copy (http://www.johnphung.com/workout-log/3350/training-log-wednesday-october-31-2012/).

    Also, if the youtube video has a minus sign (eg. JbsRv-9GBd8) the featured thumbnail URL becomes http://img.youtube.com/vi/JbsRv/0.jpg.

    Ideas?

    Thanks!

  57. apotas says: November 28, 20123:07 am

    it is working on woothemes but the image thumbnail on the feed disappear

  58. Paul says: February 13, 20139:47 pm

    Really like this plugin. Works well with the Studiopress Genesis framework.

    It's the option to have a default on tags and categories that I really like.

  59. Bob says: March 12, 20135:03 am

    Hi, I noticed that the plugin doesn't pick up images hosted on hq23.com. Any ideas why?
    Thanks!

  60. Bob says: March 12, 20137:21 pm

    Well, it seems that it's not just restricted to hq23 pics, but also to some other hosts. Some pics are picked up, others aren't. It seems to depend on whether the pic links to image itself when you hover over it (then it's picked up) or not (then it's not).

  61. Pimps says: March 14, 20132:19 am

    Not working... I Tried to change the codes of the theme, but my code is a little bit different....

    <a href="" title="" rel="bookmark">
    ID) , 'thumbnail' ); ?>

  62. Pimps says: March 14, 20132:21 am

    Not working... I Tried to change the codes of the theme, but my code is a little bit different....

    [code]

    <a href="" title="" rel="bookmark">
    ID) , 'thumbnail' ); ?>


    [/code]

  63. KatyD says: March 28, 20138:47 am

    Thank you, thank you, THANK YOU for this plug-in. It is truly glorious.

    I'm having one small issue, I'm not getting featured images from embedded videos. I'm using some custom code for this (in a child theme of Respo), and I've tried both:

    ID, 'folio-image'); ?>

    but I'm just getting the fall-back image for each of those, not a video screenie. For one video I'm using YouTube embed code, the other the WordPress embed shortcode.

    I've checked off 'Use embedded video thumbnail if available'. Is there a step I'm missing to get the YouTube screenshot?

  64. KatyD says: March 28, 20138:49 am

    Thank you, thank you, THANK YOU for this plug-in. It is truly glorious.

    I'm having one small issue, I'm not getting featured images from embedded videos. I'm using some custom code for this (in a child theme of Respo), and I've tried both:

    [code]ID, 'folio-image'); ?>
    [/code]

    but I'm just getting the fall-back image for each of those, not a video screenie. For one video I'm using YouTube embed code, the other the WordPress embed shortcode.

    I've checked off 'Use embedded video thumbnail if available'. Is there a step I'm missing to get the YouTube screenshot?

  65. Ellen says: May 12, 20133:37 am

    So, so useful, thanks so much!! { It is working great for me. } I am using this on my client's site to ensure that her RSS feed always has an associated image, which in turn gives MailChimp something to pick up and display when posting to twitter accounts and fb pages.

  66. Ellen says: May 23, 20132:07 am

    I want to follow up, since it is still doing exactly what I need it to {see my comment above} —

    However the "select image" button is currently broken on Chrome for Mac: I had to choose it for my client using a different browser. This is recent, and there were no associated upgrades, so I suspect the "current jQuery" has been updated. Some others are complaining about ColorBox suddenly not working on Chrome, i.e., jQueryUI. I'm too much of a noob when it comes to js; I will just use another browser. Please feel free to contact me privately if you want more information -screen shots, etc.

    So just a heads up, and thanks again so much, the plugin is a great boon! I don't know what I would have done without it!

  67. David F says: July 28, 20131:30 pm

    I a majority of everyone else, I really like this plugin and it does it exactly what I need and want it to do. There is just one thing, the load time this plugin takes. I have run a few load tests and identified this specific one to takes 1 sec of load time. My site can not live without this plugin but also realize load time is just as critical. The plugin that identified the this plugin is the P3 Profiler. Thanks for your help.

  68. Abdul says: September 13, 20135:26 pm

    Dear , The plugin replace my Thumbnail to the default Thumbnail . ok now how can I delete the image that I choice it to be my default Thumbnail from the plugin

  69. David F says: November 4, 20134:41 am

    how do I get this to work with the "Made" Theme by Industrial themes? This is an awesome plugin. Thank you for your help.

  70. Rolph says: November 28, 20132:18 am

    Hi, I'm just setting up a site and am using this plug which is working correctly. However, as soon as I also install the plugin "Add Tags And Category To Page And Post Types" your plugin is not working anymore. Setting a default thumbnail is still working, only if you add a category. However, the default for "any" as well as the 'first image embedded in post' is not working anymore.
    Any suggestion as I would like to use both of them.
    Thanks.

  71. Simon says: November 28, 201310:12 pm

    how can i get a bigger size of the image?
    the parameter $size does not seem to be working at all.
    thank you!

  72. Chuck Danas says: January 21, 20145:40 pm

    Love the plugin but I have one issue. I use photolux and before installing your plugin the thumbnail would not show in the "list" of posts on my blog page. It only showed when you clicked "more info" on the post. Now with your plugin activated it shows the thumbnail in the list of posts and TWICE when I click more info. HELP!!!

  73. Mike says: February 21, 20146:49 am

    I'm using a plugin called "Sermon Manager" that has its own image thumbnail scheme for the post type it creates. I can't seem to get these two to play nicely together. Is is possible? When I enable the DTP hooks, nothing will show up for these sermon posts that are pulling in a "speaker image" or "series image" as noted below. The plugin is using this code, which I already tried modifying per your earlier instructions regarding the "has_post_thumbnails" line…that didn't seem to work.

    // render sermon image - loops through featured image, series image, speaker image, none
    function render_sermon_image($size) {
    //$size = any defined image size in WordPress
    if( has_post_thumbnail() ) :
    the_post_thumbnail($size);
    elseif ( apply_filters( 'sermon-images-list-the-terms', '', array( 'taxonomy' => 'wpfc_sermon_series', ) )) :
    // get series image
    print apply_filters( 'sermon-images-list-the-terms', '', array(
    'image_size' => $size,
    'taxonomy' => 'wpfc_sermon_series',
    'after' => '',
    'after_image' => '',
    'before' => '',
    'before_image' => ''
    ) );
    elseif ( !has_post_thumbnail() && !apply_filters( 'sermon-images-list-the-terms', '', array( 'taxonomy' => 'wpfc_sermon_series', ) ) ) :
    // get speaker image
    print apply_filters( 'sermon-images-list-the-terms', '', array(
    'image_size' => $size,
    'taxonomy' => 'wpfc_preacher',
    'after' => '',
    'after_image' => '',
    'before' => '',
    'before_image' => ''
    ) ); endif;}

    Much thanks! Awesome plugin.

  74. David says: March 20, 20145:33 pm

    Hello everybody

    I need a problem i want to se the image of my post fix and over the image i need to see the name of the post

    Now when i put my mouse over the image, this image disappears, and i se the name of the post (but i dont want that)

    Example I have now

    https://dl.dropboxusercontent.com/u/22047877/ihave.jpg

    Example I need

    https://dl.dropboxusercontent.com/u/22047877/ineed.jpg

    I´m using Default Thumbnail to see the default image on the preview

    Anybody can help me?

    Thank you very much

  75. Adam says: April 6, 201410:34 pm

    This plugin is awesome, exactly what I'm looking for, it does however mess with UberMenu - for some reason it adds an Image to my Pages.

    Slightly annoying, any way to make it ignore pages completely and or anything in certain elements?

    Thanks

  76. carlos says: April 26, 201410:24 am

    i am working with the theme ExtraNews http://themeforest.net/item/extranews-responsive-wp-newsmagazineblog/6597838 .

    but I have not been able to place my feature image in each post.
    I read everything you have posted and can not find the answer.
    I re wrote the code because it is a WooThemes.

    please tell me what I can do to make it work.

  77. carlos says: May 2, 20142:32 am

    ???? ANY ANSWER?

  78. Joseph says: July 16, 20145:07 am

    Hi... Your plugin is really useful, and thanks for creating such a wonderful plugin.

    I just would like to inform you that the image doesn't appear if I reuse again the image already exist in the media library. Any idea how to fix this, please?

    Regards,
    Joseph

  79. Tim says: July 26, 20143:06 am

    Love this plugin, any way to have it rotate images for categories.. that way its not the same image being displayed over and over.

Submit comment

Pingbacks