Session

From shortcode to block

In this workshop you will learn how to adapt a shortcode-based plugin so that it also renders content in a custom block for use in the WordPress editor. The plugin will therefore no longer need to rely on the build-in Shortcode block to render the content which can instead be inserted as a block.

When converting a shortcode to a custom block it is usually best to do it by creating a dynamic block rather than a static block.

Starting with a scaffolded project, as a participant in this workshop you will go on to build out a dynamic block that works with a CPT (Custom Post Type) and a CT (Custom Taxonomy). You will learn how to use the hooks provided by the @wordpress/core-data package to pull content into the editor whilst also ensuring that the content is correctly rendered in the front-end. You will also learn how to use block attributes both in the editor and in the front-end.

You will learn how a dynamic block differs from a static block and the use cases for each.

If you already have, or are thinking of building, a plugin that uses a shortcode to render content and would like to learn how to render that content in a block as well then this workshop is for you.

Speaker