I have a custom image size that I use for my feature images. To achieve this, I added the following to my theme’s functions.php.
add_action( 'init', function() {
add_image_size( 'featured-crop', 1200, 630, true ); // 1200 width, 630 height, crop
} );
if ( has_post_thumbnail() ) {
the_post_thumbnail( 'featured-crop' );
}
I also added the following to allow the size to show in the WordPress admin. Not sure if this was needed, but I did it.
add_filter( 'image_size_names_choose', 'my_custom_sizes' );
function my_custom_sizes( $sizes ) {
return array_merge( $sizes, array(
'your-custom-size' => __( 'featured-crop' ),
) );
}
In Appearance-Customize-Layout-Blog I set the featured images to this custom size, and all is good on my Blog page (not Home page).
I’m trying to add some blog posts to the top of my Home page also. I tried the Latest Posts block, in grid view, with featured image turned on, and with the custom size selected, but it shows the Large size instead.
I also tried a Query Loop (my preferred choice since I can customize the look more), but I don’t have the option to change the image size for the featured image. I was hoping the setting used in Appearance-Customize-Layout-Blog would do the trick, but it does not.
Is there any way, either through functions.php or CSS to force the featured image, when showing posts in a block, to use the featured-crop image size I created?