- This topic has 7 replies, 3 voices, and was last updated 1 year, 4 months ago by
Tom.
-
AuthorPosts
-
December 19, 2020 at 4:07 am #1586865
Manuel
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!
December 19, 2020 at 12:40 pm #1587435Tom
Lead DeveloperLead DeveloperHi there,
Absolutely, there’s a filter: https://github.com/tomusborne/generateblocks/blob/1.2.0/includes/functions.php#L171
So you can do this:
add_filter( 'generateblocks_media_query', function( $query ) { $query['tablet'] = '(max-width: 1024px)'; return $query; } );
That way you can make it whatever you like ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentDecember 20, 2020 at 12:58 am #1587774Manuel
Hi Tom,
that’s exactly what i need. Thank a lot for the fast reply!
December 20, 2020 at 10:58 am #1588391Tom
Lead DeveloperLead DeveloperGlad I could help ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 12, 2021 at 9:23 am #1656122George
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; } );
February 13, 2021 at 11:27 am #1657164Tom
Lead DeveloperLead DeveloperYep – that’s exactly right. More info here: https://community.generateblocks.com/t/changing-the-device-breakpoints/31
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 13, 2021 at 2:37 pm #1657330George
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?
February 14, 2021 at 1:17 pm #1658201Tom
Lead DeveloperLead DeveloperThat looks good to me – is the CSS being output since using 1024px?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.