Archived topic
Generate Blocks commenting out doesn't seem to do anything!
3 replies · Started by David on May 13, 2021
Hi guys,
Probably just a simple explanation for this...
Generate Blocks creates elements wrapped in <!-- --> like this:
<!-- wp:generateblocks/button-container {"uniqueId":"43a80a70","alignment":"center","marginTop":"0","marginBottom":"0","isDynamic":true,"className":"gb-button gb-button-a35026de"} -->
My understanding is that <!-- --> is how you comment things out in HTML.
But all those instructions inside the {}'s are applied to the page.
What am I not getting?
Thanks,
Dave
Hi there,
Thats correct those: <!-- something --> are standard HTML Comments.
But the WP block editor uses them as a way of storing block related attributes, which is what you see there.
These are only saved in the editor content, not the content returned to the front end. GB and any block can parse that comment for contained attributes to apply those attributes to the block.
GB probably uses them more effectively then any other block plugin - which avoids the need for writing inline styles as you see with others.
Understood!
Thanks very much for the input.
You're welcome