WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm developing a theme for a customer in which i need several versions of the same image.

In my functions.php file i've added all the image sizes i need. For instance:

if ( function_exists( 'add_theme_support' ) ) { 
  add_theme_support( 'post-thumbnails' ); 
if ( function_exists( 'add_image_size' ) ) {
    add_image_size('frontpage-post-thumbnail', 192, 192,true );
    add_image_size('listing-post-thumbnail', 670, 290,true );
    add_image_size('preview-post-thumbnail', 640, 640,true );
    add_image_size('preview-onepost-thumbnail', 480, 480,true );
    add_image_size('preview-twopost-thumbnail', 240, 240,true );
    add_image_size('page-single-thumbnail', 160,9999, false);

Now, in my archive.php template, i need the "listing-post-thumbnail" version, but wordpress uses the original image instead. I've checked and the 670x290 version of the image exists in the same folder as the original.

Here is the code in archive.php

                        <a href="<?php the_permalink(); ?>" title="Access node: <?php the_title(); ?>">
                         <?php echo get_the_post_thumbnail($id, array(670,290)); ?>
share|improve this question
Had you checked that $id makes sense at that point? – Rarst Jul 2 '11 at 14:34
yes, it does. Besides, the right image is picked up, but not at the right dimensions. – pixeline Jul 2 '11 at 14:39
Sometimes you arrive to something semi-working in not so proper way, so I always try to start debug from the top. – Rarst Jul 2 '11 at 14:46
up vote 1 down vote accepted

It turns out WP got confused because i used the settings> medias screen to also set the "medium" dimensions to 670x290. This redundance seems to disable entirely both the "medium" and the "listing-post-thumbnail" dimensions. Replacing the medium dimension values to 0 and then regenerating the thumbnails solved the issue.

Thanks to those who tried to help!

share|improve this answer

Maybe this is a way too obvious, but have you tried calling your size by name?

<?php echo get_the_post_thumbnail($id, 'listing-post-thumbnail'); ?>


share|improve this answer
yes, i tried that at first. Should have mentioned that. – pixeline Jul 2 '11 at 14:12

Your Answer


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.