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

Is it possible to check what image size has been selected for the featured image and only display that image..

For example.

    <?php if(has_post_thumbnail('small-image')): ?>

                <?php the_post_thumbnail('small-thumb') ?>small image is showing

        <?php elseif(has_post_thumbnail('full-thumb')): ?>

                <?php the_post_thumbnail('full-thumb') ?>large image is showing

        <?php endif ?>

        <?php the_post_thumbnail() ?>default image if none selected

Not sure if that makes sense..?

share|improve this question

Yes your question makes sense. My understanding of the image attachments in WP is that you upload an image and it gets resized to all defined sizes currently defined in your instance of WP.

So you can't specify a given size for a given image upload. And therefore, there is no way of ascertaining what a specific image's size should be.

I expect the size you use is determined by its location in your theme, and specified by you in the theme. (Assuming, of course, you're the themer.)

share|improve this answer

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.