Site logo

Archived topic

GenratBlocks - change breakpoint for tablet globally

7 replies · Started by Manuel on December 19, 2020

Viewing posts 1–8 of 8

Hi there,

is there a way to change the breakpoint for tablet in GenerateBlocks globally?
Sometimes two columns in portrait are too narrow but one column in landscape are too wide.

Thanks for your great work!

Hi Tom,

that's exactly what i need. Thank a lot for the fast reply!

Glad I could help :)

Would something like that work if I wanted to modify multiple sizes?

add_filter( 'generateblocks_media_query', function( $query ) {
    $query['desktop'] = '(min-width: 1141px)';
    $query['tablet'] = '(max-width: 1140px)';
    $query['tablet_only'] = '(max-width: 1140px) and (min-width: 768px)';
    $query['mobile'] = '(max-width: 767px)';
    return $query;
} );

Ok, for some reason, it's not working for me, I am hiding an element on tablet and mobile but it still hides it at the default 1024px width instead of 1140px. I am using the following code throught the Code Snippets plugin but I have also tried putting it in functions.php:

add_action( 'wp', function() {
    add_filter( 'generateblocks_media_query', function( $query ) {
        $query['desktop'] = '(min-width: 1141px)';
        $query['tablet'] = '(max-width: 1140px)';
        $query['tablet_only'] = '(max-width: 1140px) and (min-width: 768px)';
        $query['mobile'] = '(max-width: 767px)';

        return $query;
    } );
}, 20 );

The snippet is correct, right?

That looks good to me - is the CSS being output since using 1024px?

This archived topic is closed to new replies.