Site logo

[Support request] Choose different image size for GB image block

Home Forums Support [Support request] Choose different image size for GB image block

Home Forums Support Choose different image size for GB image block

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2462805
    Anastasiya

    Hi,

    I wanted to see if there is a way to display all available registered image sizes in GB image block. I have a custom image size registered in the theme but the GB image block shows only standard Wp image sizes. Is there a way to change that?

    #2462866
    David
    Staff
    Customer Support

    Hi there,

    you have to tell WP to include the your image sizes in the editor using the image_size_names_choose filter.
    Heres an example PHP Snippet that does that:

    
    add_filter( 'image_size_names_choose', function() {
    	return [
    		'thumbnail'    => __( 'Thumbnail', 'textdomain' ),
    		'medium'       => __( 'Medium', 'textdomain' ),
    		'medium_large' => __( 'Medium Large', 'textdomain' ),
    		'large'        => __( 'Large', 'textdomain' ),
    		'full'         => __( 'Full Size', 'textdomain' ),
    		'your_custom_size' => __( 'Your Custom Size label', 'textdomain' ),
    	];
    } );

    You can adjust the last option: 'your_custom_size' => __( 'Your Custom Size label', 'textdomain' ), to match your size.

    #2463026
    Anastasiya

    Thank you David!

    It worked like a charm!

    Is there a library of all filters and possible applications that I can browse to find the solutions? There is so much that can be done with GeneratePress and I would love to learn more complex integrations or ways to use the theme and blocks plugin.

    #2463032
    David
    Staff
    Customer Support

    That filter is a core WordPress filter, of which there are probably 100s 🙂
    See here:

    https://codex.wordpress.org/Plugin_API/Filter_Reference

    For GeneratePress here are a few of them:

    https://docs.generatepress.com/collection/filters/

    For GenerateBlocks there are very few, as we try to use the core filters in our blocks.
    If theres something specific you need just ask and we can try and point you in the right direction.

    #2463066
    Anastasiya

    Thanks David 🙂

    Greatly appreciate your help.

    #2463209
    David
    Staff
    Customer Support

    You’re welcome

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.