Support » Developing with WordPress » Converting block and all nested children to HTML block

  • I am curious about container blocks (ie. blocks which support InnerBlocks) which I register using the block API, and how if at all they can be converted to HTML blocks with a sort of recursive conversion for all child blocks.

    Example. Here is my block structure.

    Container Block with DIV wrapping elem 
        |___ Paragraph
        |___ Paragraph
        |___ Container Block with DIV wrapping elem 
                |___ Container Block with DIV wrapping elem 
                      |__ Paragraph
        |___ Container Block with DIV wrapping elem 
                |__ Paragraph

    Is it possible to transform the top level parent block to an HTML block and have each successive level of child blocks (containers and otherwise) become part of that HTML conversion? So that the resulting HTML block’s content would be something like:

    <div>
    <p>Something</p>
    <p>Something</p>
      <div>
         <div>
           <p>Something</p>
         </div>
      </div>
     <div>
       <p>Something</p>
     </div>
    </div>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Converting block and all nested children to HTML block’ is closed to new replies.