Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

2. Creating custom blocks

rikkilake edited this page Jun 3, 2019 · 2 revisions

Getting started with Block Lab is easy. Look for the Block Lab menu item in your WordPress admin sidebar, then press Add New.

Start by giving your block a name, in the Enter block name here field at the top of the screen.

Next, we need to define some settings for your Block in the Block Properties section.

  • Your block's Slug will be auto-filled based on the name you chose. The slug will be important later, when creating a block template.
  • Choose an Icon to make it easier to find your block in the WordPress editor's block selector.
  • Choose a Category for your block, from one of WordPress' default block categories.
  • Give your block some Keywords, used when searching for blocks in the block selector.

The next section lets you define the options that will be presented to users when adding your block to their post. These options are known as Fields.

Fields are the points of data that could be different each time you use the block. For example, if you were creating a Button block, you could include fields for the button's text, and link URL.

Add a new field by pressing the Add Field button.

  • Give your field a Label, which will be displayed next to the input field when adding the block.
  • The field Name should auto-fill, but can be customised. This will be used by the block template.
  • Choose the control Type for the field. This is the type of input presented to the user when adding the block.
  • Depending on the Type, additional options will be available. Refer to the Field Types section below for more details.

When you're ready, press Publish in the sidebar to make your block available when creating a new post. You can also choose to save your block as a Draft, in which case your block will be saved, but not available in the editor.

Clone this wiki locally