Latest Posts Block Custom Image Size Not Displaying Correctly
-
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 this size option in the WordPress admin.
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 image size, and all is good on my Blog page (not Home page).
I’m trying to add three latest 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 displays the Large size instead of my featured-crop image size. The
width & height dimensions display as 0 instead of the preset 1200×630.Is this a bug with the Latest Posts block or something I’m doing incorrectly?
WP.com: Unknown
Jetpack: Yes
Correct account: YesThe blog I need help with is: (visible only to moderators and staff)
-
Hello, I’m sorry to hear that you are having trouble with your website. However, your site is not hosted with WordPress.com. It is a site using the open-source WordPress software (from WordPress.org) but hosted with A2.
To clear up any confusion, WordPress.com and WordPress.org are two different entities: https://wordpress.com/support/com-vs-org/
WordPress.org has complete documentation for self-hosted/installed versions of WordPress.org at https://wordpress.org/support/ and support at https://wordpress.org/support/forums/
- The topic ‘Latest Posts Block Custom Image Size Not Displaying Correctly’ is closed to new replies.