0

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?

New contributor
LatestScoop is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
0

There's a simple solution, group the blocks together:

enter image description here

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

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

  • Thanks for pointing me to this Tom. – LatestScoop Mar 26 at 7:34
0

Use '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.

New contributor
LatestScoop is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

LatestScoop is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.