[Resolved] generate blocks: custom image size in image block element

Home Forums Support [Resolved] generate blocks: custom image size in image block element

Home Forums Support generate blocks: custom image size in image block element

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2330207
    Christian

    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

    #2330291
    David
    Staff
    Customer Support

    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' ),
        ) );
    }
    #2330302
    Christian

    ok thanks a lot
    (y) ๐Ÿ™‚

    #2330316
    David
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.