How to create custom auto generated image sizes in WordPress

Posted in Web Development on 06.10.2015 by @chasebadkids

If you’ve ever needed to create custom image sizes for your WordPress installation, this¬†function will come in very handy.

This function relies on the WordPress add_image_size() function.

For your own reference the add_image_size() function uses the following parameters:

Simply modify the code below as you see fit.

Set the first parameter of your function to the name of the size you want to reference later in your WordPress theme.

You can use the following example to retrieve the custom image within your own theme / template: