0

I've got a simple photographic site and it uses large image sizes throughout.

On the archive page, however, I've got about 35 posts each showing the first image of each. By default, the images being uploaded are around 600 pixels wide. However, on the archive page they need only be 150 pixels wide.

The problem: I don't need 600 pixel wide images on this heavily populated archive page.

I understand WordPress generates smaller images when they are uploaded to the media gallery. Is there a way I can use a smaller image that has been generated instead of the large, default image?

1 Answer 1

2

Yes, there is. You are looking for the thumbnail image size, I would say.

So, for each post, don't just do the_post_thumbnail();, instead do the_post_thumbnail('thumbnail');.

4
  • Thanks. However, would that require the user to set a thumbnail in the admin interface? Is there a way to automatically set it, instead (as I am automatically pulling the first image of each post)?
    – tmyie
    Feb 13, 2014 at 16:25
  • Please provide the code you are using on your archive page. My answer is about featured images or post thumbnails, which are generated automatically when uploading an image.
    – tfrommen
    Feb 13, 2014 at 16:26
  • I use first_item(); which takes the first image from each post: pastebin.com/4F9qJUXE
    – tmyie
    Feb 13, 2014 at 16:36
  • Well, okay, this is not the WordPress way. There is no reliable way of doing what you want to do, because the image could come from anywhere (external source), it could be in your uploads folder, but you might have pushed it there by hand (i.e., not via the WordPress media upload) etc. and thus have no thumbnail equivalent. I suggest you have a look at attachments, Post Thumbnails etc.
    – tfrommen
    Feb 13, 2014 at 16:42

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.