In reply to https://jan.boddez.net/articles/conditionally-display-innerblocks. Neat Gutenberg trick: you …
In reply to
.Neat Gutenberg trick: you can have a block accept (and store) InnerBlocks
, yet still employ a server-side render callback in which you can run all sorts of logic before returning … the block’s “static” contents.
Works for things other than InnerBlocks
, too, by the way.
The trick is $block->render( array( 'dynamic' => false ) )
, which returns whatever was saved in the editor. And that can still contain dynamic content, by means of InnerBlocks
.