How to Change the Post Thumbnail Size in a WordPress Theme

If you enable post thumbnails for your theme, you will find that you may not like the default size. If you want all of your post thumbnail images to be the same size throughout your theme, then you can set it in functions.php:

set_post_thumbnail_size( 100, 100 ); // 100 pixels wide by 100 pixels tall, box resize mode

OR:

set_post_thumbnail_size( 100, 100, true ); // 100 pixels wide by 100 pixels tall, hard crop mode

However, if you want to have different image sizes for archives, custom category pages, posts, and custom post types, you can set them directly within the template tag, like so:

1
<?php the_post_thumbnail('thumbnail'); ?>

You can select from the following options:

1
2
3
4
5
6
7
the_post_thumbnail();                  // without parameter -> Thumbnail

the_post_thumbnail('thumbnail');       // Thumbnail
the_post_thumbnail('medium');          // Medium resolution
the_post_thumbnail('large');           // Large resolution

the_post_thumbnail( array(100,100) );  // Other resolutions

For more information on post thumbnails, check out the WordPress codex or Mark Jaquith’s in-depth tutorial on how to use them.

Comments (3)

Participate