Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm developing a custom theme that uses several custom image sizes defined in my functions.php like this:

add_theme_support('post-thumbnails');
add_image_size('featured_thumb', 175, 120, true);

I then get posts from the database and output on a page like this:

$featured=get_posts();
if ($featured)
{
          global $post;
          foreach($featured as $post)
          {
              setup_postdata($post);
              the_post_thumbnail('featured_thumb');
          }
          wp_reset_postdata();
}

But this code always outputs a full sized image. I can't figure out why - everything else seems to work alright (the_title(), the_permalink() etc) and it does get the correct image but not in the size I requested.

Does anyone know under what circumstances the_post_thumbnail() will ignore my image size, or what I'm doing wrong?

Edit: using WP 3.4.1

share|improve this question
    
Did you regenerate your thumbnails or upload your image after registering your custom sizes? –  Stephen Nov 23 '12 at 13:55
    
yeah I uploaded the images after writing that part of the theme - I think. To be sure I'll regenerate them again now though, that might be it. –  jammypeach Nov 23 '12 at 13:57
    
Also there is a filter post_thumbnail_size to change the size. Has any plugin or your theme hooked into it? –  Mridul Aggarwal Nov 23 '12 at 13:57
    
not my theme, but couldn't speak for all plugins. I have none installed that do anything with media, but you never know. regenerating thumbnails at the moment –  jammypeach Nov 23 '12 at 13:58
1  
Been there and done that. –  Stephen Nov 23 '12 at 14:09
show 1 more comment

1 Answer

up vote 2 down vote accepted

Remember that custom image sizes are NOT applied retroactively to images already uploaded.

Use a plugin like Regenerate Thumbnails or similar to generate them.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.