In WordPress create a new Custom Media dimension allows you to add new dimensions over the 3 already present by default and editable from the interface.
What are Media Dimensions in WordPress
By media size in WordPress, we mean the different default size options for the images you want to upload and display on your website.
The use of appropriate image sizes on one’s wordpress site allows proper loading times for pages and thus greater visibility for search engines such as Google.
For example, a thumbnail (thumb) can be used to display a gallery preview image, while a full-size image can be used as a cover image.
Default Media Size
In WordPress, each Media dimension is identified by a call sign; these are the default dimensions that are set with the installation of the CMS:
– Thumbnail 150×150
– Medium 300×300
– Large 1024×1024
It is possible to customize the default size through the WordPress interface from Settings -> Media
Enter a new Custom Media dimension
To create a new Custom Media dimension in WordPress simply, for each desired dimension, add the following line to the functions.php file of the theme:
add_image_size( 'custom-image-size', 600, 400, true );
Where you can customize the following parameters:
- ‘custom-image-size’: name of the chosen size
- 600: width of the chosen size
- 400: length of the chosen size
- true: boolean true|false for image cropping
It is possible to refer to the WordPress documentation for more details about the former function: https://developer.wordpress.org/reference/functions/add_image_size/