Create Your Own Block Patterns for Gutenberg / the Block Editor
Block Patterns in Gutenberg are a powerful way to make reusable content templates without having to grab all of the blocks and build them from scratch in the WordPress Block Editor. But currently there isn’t a native no-code way to create patterns. Luckily, creating your own is as simple as copying and pasting some code. Here’s how to do it from start to finish.
Join the Build Something Club! https://buildsomething.club
## Links
Get the Code: https://github.com/jcasabona/jc-block-patterns
JSON Encoder: https://jsonformatter.org/json-escape
register_block_pattern: https://developer.wordpress.org/reference/functions/register_block_pattern/
## Chapters
00:00 – Intro
01:16 – Why Not Reusable Blocks?
03:11 – Designing the Block Pattern
04:42 – Copying the Block Code
05:05 – Escaping Block Code
05:53 – Plugin Setup
07:16 – Registering the Block Pattern
08:08 – The Block Pattern Definition
09:03 – Pattern Categories
09:47 – Adding our Block Code
10:02 – Testing
11:20 – Reviewing all the Steps
11:53 – Multiple Block Patterns
12:23 – That’s It!
~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~
To learn more, start here: https://casabona.org/start
Join my mailing list: https://buildsomething.email
Check out my Live Stream Gear: https://kit.co/jcasabona/youtube-live-stream-setup
Check out my Podcasting Gear: https://kit.co/jcasabona/my-podcasting-setup
~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~
Source