By default, every image uploaded via WordPress Media manager will be uploaded to different sizes. However, when displaying them as featured image, the image needs to be re-sized or cropped to get the desired size. This code should go in your functions.php file of your child theme (Yes, I strongly recommend you to use a child theme to make any customization to your theme).
Here is the parameter you need to register a new size of the featured image:
For more details, see the WordPress Codex.
<?php // Add new featured image size add_image_size( $name, $width, $height, $crop ); ?>
The last parameter, $crop is should be set to TRUE for hard cropping. By default, it returns false.
Here are some examples:
<?php // Add new featured image sizes add_image_size( 'grid-thumbnail', 236, 157, TRUE ); add_image_size( 'single-post-thumbnail', 236, 236, TRUE ); add_image_size( 'video-small', 110, 73, TRUE );
Leave a Reply