- This topic has 10 replies, 3 voices, and was last updated 3 years, 4 months ago by Leo.
-
AuthorPosts
-
December 18, 2020 at 9:11 am #1586194Joel
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 #1586458TomLead 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!
December 19, 2020 at 1:13 pm #1587473JoelThat’s great, thanks for your help
December 19, 2020 at 1:37 pm #1587500JoelSorry 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 #1587663LeoStaffCustomer 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.
December 21, 2020 at 2:36 am #1588895JoelOk, thank you
December 21, 2020 at 5:27 pm #1589988LeoStaffCustomer SupportNo problem 🙂
December 24, 2020 at 3:48 am #1593002JoelSorry 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 #1593464LeoStaffCustomer SupportYou can only set the default as Tom pointed out above but not possible to set it conditionally.
December 24, 2020 at 11:07 am #1593503JoelOk thanks, would be a nice feature!
December 24, 2020 at 11:40 am #1593519LeoStaffCustomer SupportI would say that it’s very rare to set the content container to default when GB is used.
-
AuthorPosts
- You must be logged in to reply to this topic.