Gutenberg – Page 2

Create Block Patterns Programmatically

Recently I’ve been implementing an automatic block pattern synchronisation feature into my Simple Multisite Crossposting plugin and decided why not to talk about it in a new post.

The goal of this tutorial is to learn how to create both synced and not synced block patterns programmatically and to assign specific pattern categories to them.

Creating Custom Notices in Block Editor (Gutenberg)

Recently I’ve been working with my Simple WP Crossposting plugin and I found out that in order to make the experience with the plugin even more simple I need to add some custom notices for users.

Adding those notices in Classic Editor is super simple – we just need to use admin_notices hook and there we go. But in Gutenberg things may become just a little bit more complicated.

Anyway we are going to figure everything out in this tutorial.

Site Editor Command Palette

In this tutorial we are going to talk about WordPress command palette and also going to add some custom commands into it.

The command palette is intended to simplify the process of site editing in FSE. In order to open it you need to use Cmd + K combination or just click on a document title.

Site editor command palette

Another way to open it is to click on this search button:

How to open WordPress site editor command palette

Gutenberg Block Categories: How to Create a Custom One

In this lesson, we will continue working with our custom Gutenberg block, and this time, I would like to talk about Gutenberg block categories.

As you probably remember, when we were working with the block.json file of our custom block, we provided the category parameter to it, and we decided to put our block into a “Text” block category.

However, it is also possible to create a custom block category for our Gutenberg block, and I will show you how in this lesson.

How to Change Core Blocks with Block Filters

In this tutorial we are about to learn how to work with WordPress block filters, blocks.registerBlockType in particular. This filter allows not only to change block attributes and their default values but also other block data like title, description etc.

Using @wordpress/create-block tool in Block Development

If you are a big fan of WordPress starter themes, then you will absolutely love the npx @wordpress/create-block terminal command.

But it is not the only reason why we need this tool when creating custom blocks for Gutenberg.

In the video lesson below, I will explain everything step by step and show you how to use it and how to create your first starter block for Gutenberg in a matter of minutes. You can also find the command documentation under the video.

Create a Repeater Field in Block Settings (Inspector Controls)

I got some experience with repeaters when I was developing it for my Simple Fields plugin and I also have a whole tutorial about using them in Plugin Sidebars.

But recently I faced with another challenge – I needed a repeater field as a block setting inside Inspector Controls (in my Simple Carousel Block it was intended to configure multiple responsive breakpoints). Like this:

Repeater Field in Gutenberg Block Settings
It is exactly how “Responsive” option looks and works in my Gutenberg carousel block.

And that is when the things didn’t go as expected at all. So let me just break it down for you if you’d ever face with something like this.