How to set thebu base Post Thumbnail Size
Setting your Post Thumbnail size is incredibly easy via your theme’s functions file. Simply add and customise one of the two lines below:
set_post_thumbnail_size( 150, 150 ); // Creates a proportionate image 150px by 150px set_post_thumbnail_size( 100, 100, true ); // Creates a cropped image 100px by 100px
And if your theme doesn’t already bring out the thumbnail, you can simply use the following code within the query Posts Loop:
<?php the_post_thumbnail(); ?>
How to create additional custom Featured Image sizes
add_image_size( 'small-featured', 400 ); // Creates a proportionate new image 400px wide with unlimited height add_image_size( 'small-cropped', 200, 200, true ); // Creates a cropped new image 200px by 200px high
Once you’ve set your new sizes on the theme’s functions.php file, you can then call them out on the front-end by using referencing them in either of the following ways:
<?php the_post_thumbnail( 'small-featured' ); ?> <?php the_post_thumbnail( 'small-cropped', array('class' => 'classname')); // to add a class to the img tag ?>