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.

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
add comment

1 Answer

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
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.