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()
- Manipulating the allowed inner blocks of a core-gutenberg-block?
- Adding features to Gutenberg without theme.json
- Registering a custom block style
- Get column block count using PHP method render_block
- do_blocks not working with a custom block
- ACF block gutenberg aligncenter don’t work
- Execute a PHP Function when a Block is used and access it’s attributes
- How to edit templates created in the block editor in code / template files not updating
- Programmatically convert single classic block to individual blocks via PHP
- Add custom data attribute to every core Gutenberg Blocks
- Embed dynamic media query in a Gutenberg block
- Get generated block styles programmatically
- Custom gutenberg block refuses to load viewScript and I don’t know why
- When a foreach loop is used multiple times in blocks, is there a way to ensure a variable always has a unique value?
- Prevent render in editor via PHP
- How to get the post title inside a custom block in a loop? block.js
- How to display only the first 2 words of a post title
- How to get the content of a dynamic block in PHP
- Set custom post type to load custom block pattern by default
- Admin ToolBar not being displayed at top of site
- How can i display a jquery slide on front page
- AJAX – Returning Two JSON Objects with One PHP Function
- WordPress Options Page Theory Question
- Pull GetOption() variable into jQuery dynamically created html
- Saving zero in meta box
- How to edit php code in WordPress Post file?
- How to show a users bio on a page
- site_url and $current_user producing undesired results
- Create a Blog Template Page
- How to make widget title accept php?
- Is the wp_enqueue method efficient?
- Filtering a Database Query
- Custom PHP App with a wordpress site
- Royalty-Free Sliders used in theme development
- How can I open up my administrative panel to everyone?
- Change page title from page using php via php executed from page/post itself
- Download images from media library to computer in BULK?
- Define specific category name in PHP
- Can I get an email notification when media is uploaded to the media library?
- PHP Syntax Error on get_posts
- Showing latest post without 301 redirect
- Trying do build a contact form
- Make Current/Active Page Number a Link (WP_LINK_PAGES)
- Convert WordPress date format to jQuery UI Datepicker format
- How to show number of unpublished articles?
- How to make modifications only to certain elements of an HTML string on the server-side?
- “operation successful” message
- WordPress wp_redirect error
- Three Questions with Twenty Eleven theme
- PHP echo inside javascript
- single.php error
- WordPress Theme Modification Help
- Value prints outside of the echo
- RTL Stylesheet Confusion with WordPress