- This topic has 10 replies, 3 voices, and was last updated 1 year, 6 months ago by
Leo.
-
AuthorPosts
-
December 18, 2020 at 9:11 am #1586194
Joel
Hello,
I’ve been playing about with the various layout options using the customiser, layout elements etc. And I was wondering what the best practice was for doing this if generally we will be using GB for content?
Let’s say I want the content to generally be contained to 1200px but there will be some full width sections (e.g. for backgrounds, banner images etc).
Is it better to create a layout element at full width and use GB to contain the content (when I tried this it didn’t seem to affect existing pages, is that the expected behaviour?).
Or is it better to use the customiser to contain the content to 1200px and only enable full width when needed?
And following on from that, is it possible to set default padding for the GB container block because at the moment it adds 40px each side so the content doesn’t align with other content like the header etc?
Thanks
December 18, 2020 at 1:17 pm #1586458Tom
Lead DeveloperLead DeveloperHi there,
This really depends on preference. Some people like to set each individual block to full-width, but I don’t love the code that’s necessary for it to break free of the parent container.
Personally, I prefer to start with a full-width page, and then add contained blocks as needed. The Container block in GB will automatically use the Container Width set by GP in the Customizer if you don’t change it.
For the padding, you can do this:
add_filter( 'generateblocks_defaults', function( $defaults ) { $defaults['container']['paddingTop'] = '40'; $defaults['container']['paddingRight'] = '40'; $defaults['container']['paddingBottom'] = '40'; $defaults['container']['paddingLeft'] = '40'; return $defaults; } );
Hope this helps!
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentDecember 19, 2020 at 1:13 pm #1587473Joel
That’s great, thanks for your help
December 19, 2020 at 1:37 pm #1587500Joel
Sorry just had another thought…is it possible to set the Content Container default to ‘Full Width’? And then change it to ‘Default’ on a few pages as needed? I know I can set up a Full Width Layout Element and exclude certain pages but I’m wondering whether this could be done in the editor for colleagues who may not have access to GP settings.
Thanks again.
December 19, 2020 at 7:55 pm #1587663Leo
StaffCustomer Supportis it possible to set the Content Container default to ‘Full Width’? And then change it to ‘Default’ on a few pages as needed? I know I can set up a Full Width Layout Element and exclude certain pages but I’m wondering whether this could be done in the editor for colleagues who may not have access to GP settings.
Unfortunately that’s not possible – it would need to be excluded within the layout element.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/December 21, 2020 at 2:36 am #1588895Joel
Ok, thank you
December 21, 2020 at 5:27 pm #1589988Leo
StaffCustomer SupportNo problem 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/December 24, 2020 at 3:48 am #1593002Joel
Sorry one more follow up question, is there any way of setting the GB padding defaults to change based on the Content Container selection? Ideally I would like the default padding for left and right to be 0 if the “Default” Content Container is selected, and it to be 40 if the “Full Width” Content Container is selected.
Thanks again and Happy Christmas!
December 24, 2020 at 10:37 am #1593464Leo
StaffCustomer SupportYou can only set the default as Tom pointed out above but not possible to set it conditionally.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/December 24, 2020 at 11:07 am #1593503Joel
Ok thanks, would be a nice feature!
December 24, 2020 at 11:40 am #1593519Leo
StaffCustomer SupportI would say that it’s very rare to set the content container to default when GB is used.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.