• Amid

    (@aminteractiondesign)


    Hi,

    how does set_post_thumbnail_size() make sense, when there are three default sizes (thumbnail, medium, large).

    So which of those sizes do i set with that one function set_post_thumbnail_size()?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Technically, you don’t have to call set_post_thumbnail_size() at all if you want to use one of the predefined sizes (on a personal site, you’ll change these at Dashboard > Settings > Media); you can just pass the argument directly to the_post_thumbnail():

    <?php the_post_thumbnail( 'large' ); ?>

    If you’re developing a theme for distribution, where you can’t count on being able to set the image sizes, you call set_post_thumbnail_size() to explicitly set the pixel dimensions of the post thumbnail, if you need a specific size to work with the design.

    Thread Starter Amid

    (@aminteractiondesign)

    Yeah I know all that, but what when I don′t want my upload folder cluttered with image sizes I don′t need in my theme?

    You could set all the sizes to be 0, which would suppress the automatic resizing for all newly-uploaded images. You’d also have to make sure your theme and any plugins don’t register any custom image sizes.

    You could then manually remove all the automatically-generated resized images from wp-content/uploads, but you’d have to carefully check all previous posts and pages because the image links are hardcoded to the specific size when you originally wrote the post/page.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how does set_post_thumbnail_size() make sense?’ is closed to new replies.