How to add New Thumbnail Size in WordPress

If you want to add new thumbnail size, just add the ff:

if ( function_exists( ‘add_image_size’ ) ) {
add_image_size( ‘my-thumb’, 220, 180, true ); //(cropped)
}

 

to retrieve the image, simple call

get_the_post_thumbnail(get_the_ID(), ‘my-thumb’);

Note:

You have to rebuild thumbnails of older images in the media. To do this, go to Media -> Library. Select an image and click Rebuild Thumbnails.

To may have to do this one by one.

 

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPrint this pageEmail this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *