2

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

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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