How to Add Custom Image Sizes in WordPress

When image is not suitable according size than we need to use custom image size for wordpress.
its very easy part for adding that.
lets i suggest you how to do it.

you need to add code into function.php of theme file

There is 4 parameter into function.
1) Defines name of your new image size as ‘your-new-size’.
2) Defines the width as 400 (in pixels).
3) Defines the height as 300 (in pixels).
4) (True) Crops the image to the specified dimensions using center positions.

parameter 4 is optional parameter.

if you want to get that size of image than you need to pase define name like below

for that you need to regenerate thumbnail so new size will be generated.

you can Regenerate Thumbnails plugin. this is good thing for setup it.

Leave a Comment

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

The reCAPTCHA verification period has expired. Please reload the page.