0

I'm getting post thumbnails by calling the_post_thumbnail(array(400,300), true); However, this displays the fullsize featured image, just resized with the html "height" and "width" tags. This is not good for loading times. I've tried regenerating thumbnails and that doesn't make a difference.

Isn't there a way to get thumbnails that have been resized?

0

Your example code is calling the full size image as you mention and resizing to the dimensions you feed into the array.

I've answered this question before here, but the basic idea is that you'll want to use add_image_size() in your functions.php to tell Wordpress you'd like it to create a new image size when you upload images.

Then you'll need to use wp_get_attachment_image() to call the image into your template.

  • 1
    One has to regenerate the thumbnails again (for previously uploaded images) after adding new image sizes. – Chittaranjan Jan 30 '14 at 18:56
  • Good point, I mention it in my linked answer, but was unsure of whether I should just duplicate my exact answer. – Stephen S. Jan 30 '14 at 21:24

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.