Open richtabor opened 3 years ago
I've run into this issue and wondered if it was intentional or not. From a theme development standpoint the ability to set full and contained widths via the site editor feels pretty important.
The inability to use Full-Width blocks in Template Parts is causing some headaches for us and our hybrid theme.
A simple use case is that we have a Template Part above the primary post listing. We absolutely want folks to be able to use full width blocks here, but it seems impossible.
I'm attaching an example of what we're trying to do, which seems impossible due to #30079
While this does not fully address the main issue, you can use full-width blocks within a template part. The key is you need to set the template part to "align":"full"
if it's contained within another Group block.
The markup for the template part in the above screenshot using TT5 is:
<!-- wp:template-part {"slug":"footer-3","theme":"twentytwentyfive","align":"full"} /-->
While this does not fully address the main issue, you can use full-width blocks within a template part. The key is you need to set the template part to "align":"full" if it's contained within another Group block.
Unfortunately, I don't think that helps in the case of theme-provided Template Parts, which is our situation. :/
Ah this is due to the issue @carolinan described in the contributor notes on the block_template_part() docs page. When rendering a block template part in a PHP template the wrapper element is not rendered, only the content inside of the template part. Because of this, you cannot apply "align":"full"
to the template part itself as I suggested, and as you would do in a block theme. I'm not sure about the backward compatibility implications, but it feels like the block_template_part()
should be fixed to increase parity between the classic and block theme implementations.
Right now you would render a 404 template like:
block_template_part( '404' )
But perhaps the function could be expanded to something like:
block_template_part( string $part, boolean $wrapper, array $wrapper_args )
Is there an existing issue for this?
Have you tried deactivating all plugins except Gutenberg?
Have you tried replicating the bug using a default theme e.g. Twenty Twenty?
Description
I should be able to modify a parent group block's alignment width setting (wide/full) when editing a template part in a template part's editor view within the Site Editor.
When applying a background color in the template part editor view, it seems the group block is 100%— but here's what we get instead:
So I went to ensure it was set to
alignfull
l, but the template editor view would not allow it. However, I could go into the standard Site Editor view (editing the singular template for example) and I was able to properly set the width to alignfull.Step-by-step reproduction instructions
Expected Behavior
I can set alignfull/alignwide while editing a specific template part.
Current Behavior
The align controls are missing (wide/full) when viewing a template part within its own edit view.
Screenshots or screen recording (optional)
Editing a template part within the Site Editor > Singular template (works):
Editing a template part on its own view:
Code snippet (optional)
No response
WordPress Information
5.8
Gutenberg Information
11.2.1
What browsers are you seeing the problem on?
No response
Device Information
No response
Operating System Information
No response