admin管理员组文章数量:1134587
I would like to be able to create sections of blocks from within the Gutenberg editor. This way I can apply styles around groups of blocks.
The idea would be to either:
- Nest one or more blocks within a container div/section/article
- Add an opening tag before a block or group of blocks and a closing tag afterwards
I have tried adding a 'Custom HTML' block before and afterwards with opening/closing tags. This works apart from when revisiting the editor the you're welcomed with a 'This block contains unexpected or invalid content' warning.
How can I achieve this?
I would like to be able to create sections of blocks from within the Gutenberg editor. This way I can apply styles around groups of blocks.
The idea would be to either:
- Nest one or more blocks within a container div/section/article
- Add an opening tag before a block or group of blocks and a closing tag afterwards
I have tried adding a 'Custom HTML' block before and afterwards with opening/closing tags. This works apart from when revisiting the editor the you're welcomed with a 'This block contains unexpected or invalid content' warning.
How can I achieve this?
Share Improve this question asked Mar 25, 2020 at 16:54 ScoopScoop 1011 silver badge6 bronze badges2 Answers
Reset to default 4Use 'Groups': If you do not see the 'Group' option, like me, you'll have to update WP.
After that, simply create a group, then add new blocks or drag existing blocks into it. Select the group and add HTML Anchors and classes via the 'Advanced' tab of the block's menu.
There's a simple solution, use a group block:
This creates a group block that contains the others. This isn't the only block that can have "children" or nest other blocks, e.g. columns, cover blocks, etc
Group blocks are <div>
's but can also be set as sections/asides/etc in the block inspector sidebar
If this wasn't an option, the solution would have been to build a block that contains other blocks, but those blocks already exist and come with WP
本文标签: Wrapping Gutenberg Blocks with a divsectionarticle
版权声明:本文标题:Wrapping Gutenberg Blocks with a divsectionarticle 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736862156a1955963.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论