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)); ?>
  • 1
    Had you checked that $id makes sense at that point?
    – Rarst
    Commented Jul 2, 2011 at 14:34
  • yes, it does. Besides, the right image is picked up, but not at the right dimensions.
    – pixeline
    Commented Jul 2, 2011 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
    Commented Jul 2, 2011 at 14:46

2 Answers 2


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!


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'); ?>


  • yes, i tried that at first. Should have mentioned that.
    – pixeline
    Commented Jul 2, 2011 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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