Server rendered blocks like that can’t have child blocks.
The closest you can do is call do_blocks
and pass it block markup, but this means pre-creating the block in the editor, and copy pasting it out. It would not be modifiable in the editor, or appear as a block. It would just be additional HTML in your server rendered block.
If you want to get around that, you’ll need to break your dynamic block up into multiple blocks. This is how site editing blocks work around this. For example they have query blocks that provide context that can be read by child blocks, then they get filtered on the frontend to replace individual blocks content. E.g. a post title block renders the post title in PHP using information it got from a parent. As a result you can insert any block you want into a query block, even though it’s running PHP to grab data.
Related Posts:
- How to serialize a Gutenberg block from block attributes in PHP?
- Removing Default Gutenberg Blocks, But Keeping Reusable Block Functionality?
- is_admin returning false in backend in server side rendered block
- Gutenberg Blocks doesn’t render correctly when using do_blocks
- add_meta_boxes action with refresh on save
- Gutenberg custom block using only register_block_type() and HTML
- Include a Gutenberg Block in a PHP file
- Create custom blocks for bootstrap
- How to return output of the new wp gallery block for automatically Link images To Media file
- Register JS for block on frontend only
- Displaying admin notices inside the block editor from rest_after_insert_{$this->post_type} hook
- How to programmatically add Gallery Block to Existing Post Content
- Best way to add more options to Gutenberg “More Rich” text controls drop down
- Fetch post block/field data as JSON with WordPress API
- Gutenberg block – Save PHP function’s output as HTML?
- Where to find documentation for CPT block template? (PHP)
- Generate YouTube image thumbnail in a Gutenberg block – ACF + Timber
- Add class to group inner container
- Multiple requests external data api dynamic block gutenberg
- How to keep the capability of users and disable Gutenberg editor in WordPress?
- parsing nested blocks (in columns, etc) via PHP
- Passing the name of selected color from the custom component to `render_callback`
- InnerBlocks with allowedBlocks not working with acf_register_block
- Guttenburg and Classic Editor – How to use the custom guttenburg block in classic editor?
- How to render a block from php template
- Want to unrestrict plugin block
- WordPress – Get Posts with Category data
- Additional file upload in Gutenberg page options/featured image
- Add Block Before Entry Title Using PHP
- How to populate a Gutenberg select field SelectControl with option value from PHP array
- Gutenberg Blocks and get_option() for styling
- How to extend SelectControl with data from my theme
- Copying and pasting to WordPress “code editor” code via the front end and clipboard
- Gutenberg block don’t save rich text content
- Is there a PHP function that will return the block ID generated by WordPress?
- register_block_type is not working properly
- Categories does not show Block editor WordPress
- Block that renders html saved in a php file
- Show Gutenberg facebook embed with a custom theme
- Gutenberg – render_callback does not pass ToggleControl value on frontend
- Add default block css when the block has been added with php?
- Custom Post Type doesn’t have template content when creating programmatically in PHP but does when created in WP Admin
- How to add different menu items on different menus?
- How to enable REST API on custom post type without Gutenberg?
- Replace block content with an array
- WordPress Block Editor Gutenberg running code inside ! is_admin()
- the_date() not working
- How to return number of found rows from SELECT query
- Extract the first oembed url inserted on the content of a post
- WP API V2 returning Invalid User ID
- Why does $_SESSION only work when I am logged in?
- How to make an meta_query optional?
- How to use copy() function and paste file in /wp-content/themes directory
- How can update custom meta for all posts
- Sanitize get_query_var() url parameters
- PHP/MySQL issues when running WP on EC2 cloud [closed]
- How to safely remove the footer (twentytwenty)
- How do I fetch all comments per post via WP REST API?
- When using the_author hook, how can I determine the PHP file that generates each call to `the_author()`?
- Using More Tag in Combination with the_excerpt
- combine Code 1 with Code 2
- Custom Form Processing Issue
- Custom theme: Alternatives to long list of ‘include’ in functions.php
- Reordering Buddy Press profile navigation [closed]
- How can I get the total number of installed importers?
- MetaBox body is not showing (the callback function)
- Change title only in dynamic page
- How to make products with no cost in WooCommerce
- Pass php dynamic variable to shortcode
- Help with .htaccess and Login with Subfolders
- Catchable fatal error on 3.6 update
- AJAX – Returning Two JSON Objects with One PHP Function
- How can I access string value in an array?
- Defined WordPress Memory Limit to Unlimited
- Errors after upgrading PHP to 7.4 WordPress
- How to make jquery count down timer function manually editable
- How Do I Find & Remove H1 From Site-Title-Wrapper? [closed]
- Redirect a WP created page to a manually created PHP file inside theme folder
- Output category list inside array
- How to make a conditional statement within $output in shortcodes.php?
- Extend Menu Walker Output
- Strip from or something better?
- Inline related post Gutemberg
- wp_query with multiple arguments with AND
- switch_to_blog() + do_action(‘generate_footer’) not working in multisite
- Woocommerce – if selected attribute term equals
- split 1 cart item into instock and back ordered
- Display page content in different sections – based on page break block?
- WP Error using wp_insert_term
- post_exists stops working in a scheduled event
- Pagination – Previous link is not show and Next link sticks at page 2
- Add class to all meta boxes for a custom post type
- Override 404 when navigating to single php file
- I’m writing my first plugin and my echo output is showing up on every page of my wordpress installation
- Beyond widget side menu editing, with the php page, custom template
- wp_delete_comment is doing nothing
- conditionally load a default static image if image metabox has no value
- Let users register weight each day and save it in DB
- php 7.0 update to 7.1 and at least 7.2
- Custom form that stores data in mysql database