Block Vertical Alignment Controls
Recently I was developing vertical alignment controls for my carousel block and decided to share the process with you. Especially since there is not a lot of information about vertical alignment, but tons of tutorials about wide and fullwidth alignment.
Here is how it looks:

Display Plugin Sidebars and Custom Fields for Specific Page Templates Only
We kind of did the similar thing on my blog, when we restrict displaying <PanelBody>
only for specific post types. In this tutorial we are going to do almost the same, but for the condition we take a page template selected for post.
This is an example how it is going to work:

How to Add CSS to Block Editor Based on Post Type
I have multiple post types on my website, for example you’re reading a normal post, but there are also support articles like this one. The posts are almost similar except one thing – the heading font size.
It is quite easy to change the title font size depending on a post type on a website, you just have to make sure that your theme is using body_class()
function and then you can use a CSS selector like .single-{post type} h1
, but this way will never work in Gutenberg! So please don’t try to add classes via admin_body_class
or anything like this.
Repeater Field in Gutenberg Plugin Sidebars
I already have a plenty of tutorials on my blog where we created different kind of fields for Gutenberg sidebars, for example an image field, a gallery field, a checklist and even a dropdown with posts.
There is also my Simple Fields plugin for those of you guys who don’t want to mess up with JSX and React and prefer to use simple PHP code snippets instead.
But now let’s talk about creating a repeater field. First things first – a screenshot:

How to Upload Multiple Images with <MediaUpload>
Now so long ago I published a tutorial about creating a custom image control component for plugin sidebars. The very first question in the comments was “How to select multiple files”?
So let’s dive into it now.
First things first let me show you what we are going to create here.

Creating Checklist Component for Gutenberg Sidebars
I already have a couple of tutorials about working with metadata in Gutenberg, so you can find a complete guide to it and a separate tutorial about image fields. Now let’s continue to dive into it and discuss types of fields that consist of multiple input elements.
We are not going to dive straight into the repeater fields (let’s do it later) and discuss something more simple, a checklist field for example.
That’s how it is going to look like:

Image Control Component for Gutenberg Sidebars
I have a super-detailed tutorial about plugin sidebars on my blog. But there were described only some basic field types like TextControl
, TextareaControl
and ToggleControl
.
What about something much more interesting? I mean when there were no Gutenberg years ago, I already created an image uploader field for WordPress meta boxes or options pages. What about creating a custom ImageControl
component for Gutenberg sidebars right now?
