Site logo

Archived topic

generate blocks: custom image size in image block element

3 replies · Started by Christian on September 1, 2022

Viewing posts 1–4 of 4

Hi :-)

using:
add_action( 'init', function() {
add_image_size( 'Teaserlisting', 570, 370, true ); // 570 width, 370 height, crop
});
i can add and choose the size in the customizer.

I want a custom size for the image block of generate blocks.
How can i do this?

thx

Hi there,

you need to tell WP to show you custom image size name in the editor. Which can do with the image_size_names_choose filter hook:

add_filter( 'image_size_names_choose', 'my_custom_sizes' );
function my_custom_sizes( $sizes ) {
    return array_merge( $sizes, array(
        'your-custom-size' => __( 'featured-crop' ),
    ) );
}

ok thanks a lot
(y) :-)

You're welcome

This archived topic is closed to new replies.