-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to modify margins/paddings for template parts #47637
Comments
In the video, it looks like the style you turn off is The problem might be caused by block spacing, if you try reducing block spacing in your global styles > layout settings, does it reduce the gap? |
It could be related to the issue or one of the related issues - #43404. |
Good point. Actually, the
Yes. Screen.Recording.2023-02-01.at.11.00.43.mp4 |
Hi, |
As an alternative, you can wrap it in a group block and remove the margin there. The tricky part about applying styles to the template part block is that the styles are not synced, only the bits within the template part. |
I think a better option would be to zero out template part margin, so it’s not affected by the block gap. But that introduces other minor issues like when you don’t want your content right up to your footer. |
So, you can sort of do what you need in theme.json, by adding a custom class to the template part using the Site Editor and then using {
"styles": {
"blocks": {
"core/template-part": {
"css": "&.site-footer { margin: 0; }"
}
}
},
"templateParts": [
{
"title": "Footer",
"area": "footer",
"name": "footer"
}
],
"version": 2,
"$schema": "https://schemas.wp.org/wp/6.4/theme.json"
} But this feels less than satisfactory. Better, would be if there was a way to use spacing settings on individual parts. {
"styles": {
"blocks": {
"template-part/footer": {
"spacing": {
"margin": {
"top": "0"
}
}
}
}
},
"templateParts": [
{
"title": "Footer",
"area": "footer",
"name": "footer"
}
],
"version": 2,
"$schema": "https://schemas.wp.org/wp/6.4/theme.json"
} Unfortunately, this doesn't seem to be a thing, or at least, I haven't found anything like it. |
I also found this problem and solved it through a support topic.
|
Description
I am facing an issue with the Site editor. I want my content to be followed directly by the footer, without any margin. However, this is not possible as the footer automatically gets the
CSS class "wp-block-template-part", which has a margin.It is not possible to turn this off for this specific part (footer), and I do not want to globally change the block spacing as it would completely alter my theme.It should be possible to adjust margins (and probably also paddings) for template parts individually.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Screen.Recording.2023-02-01.at.10.14.05.mp4
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: