0

I have two working blocks hero Carousel and hero Carousel Slide. When I hard code these blocks in the template file they do not appear nested in the editor. In the editor, I am able to drag and drop the child block into the parent block as well as use the + icon to add the child block into the parent. How does one invoke blocks with nested blocks in a template file, when creating a bespoke theme.

in front-page.html

<!-- wp:mytheme/herocarousel /-->
  <!-- wp:mytheme/herocarouselslide /-->
<!-- /wp:mytheme/herocarousel /-->

1 Answer 1

1

If you insert things the way you want in the editor and then copy and paste them you'll get the correct output.

The mistake you've made here is the / closing the block comment:

<!-- wp:mytheme/herocarousel /-->

Should be:

<!-- wp:mytheme/herocarousel -->

Only use /--> if the block has no content or children.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.