How to Add a Custom Size for Thumbnails for WP – Gallery

Use add_image_size():

add_image_size( 'custom-name', 123, 456, true );

…will create image size custom-name, with dimensions of 123x456px, hard-cropped.

Edit

Re this comment:

Thanks for comment but honestly I got more confused!can you please let me know what is the ‘custom-name’? How I can associate this name with Gallery thumbnails?

The custom-name is arbitrary. It’s whatever you want it to be. You could call it gallery-thumb, if you want to:

add_image_size( 'gallery-thumb', 123, 456, true );

Then, you would output that image size by passing gallery-thumb to the_post_thumbnail():

the_post_thumbnail( 'gallery-thumb' );

In your case, I assume you’re using the core WordPress shortcode? If so, you can pass the size attribute: