Gutenberg, blocks and conditionals

For 7 years, I used Headway as a theme/page builder, and when I needed to use conditionals to hide/display content, I would be able to add them to the WP builder and use that inside an HT block.

Last December, I had to switch to Elementor as a page builder, and I can still use the conditionals in the same way, since the content is typically able to fit inside a wp editor while NOT using Elementor for those pages.

Now, considering that Gutenberg is also using blocks, how would conditionals be applied (assuming someone is NOT using the Classic editor). And then, that might also help figure out how to use conditionals with any other page builders, like Divi, Elementor, Beaver Builder, etc. as those are becoming more and more popular.

The s2If shortcode should still work normally in a Paragraph block. https://wordpress.org/support/topic/understanding-shortcodes-with-gutenberg/#post-10624808

There’s also the Shortcode block. https://gogutenberg.com/blocks/shortcode/

PHP code in Gutenberg is simple: use a Text block, and a plugin for PHP, e.g. ezPHP. https://wordpress.org/plugins/ezphp/

I hope that helps. :slight_smile:

Actually, it only partly answers.

What if not all content would necessarily fit inside a SINGLE block? Let’s say that I have three paragraphs, and a table, and an image that would be displayed based on one condition, and another set of content for a different condition. Does that mean that the condition has to be repeated in each individual block? Maybe that is the way, but it could be tedious. Is that the only way?

I see. Well, considitional would work inside a single block, not across many blocks. So yes, you’d need to repeat the condition for each new block, I guess, or put all the content in a single block within just one conditional…