Create Block
You can create custom blocks with output HTML or PHP. Also, blocks may work with custom meta fields, that will be available from the PHP to output in your theme code.
-
Navigate to WordPress Admin → Lazy Blocks
-
Click Add New button
Block Edit Screen
Main section
- Controls – controls to manage your block options. The full description read on this page
- Code – PHP or HTML + Handlebars syntax, which you can use to output data from block controls. See blocks code page for more info.
- Frontend – code, that will be shown on your site content, when you use your block. Keep it empty if you don't want to output anything (if you need to use this block as custom meta field)
- Editor – code, that will be shown in the editor on your block
- Single output code for Frontend and Editor – check if you don't want to split code for frontend and editor and use a single code for both places
- Output Method – select HTML + Handlebars or PHP code output method
- Code output in editor – select the condition when block preview will be visible in the editor
- Native block style in editor – display the block in native style without frame border
Secondary section
- Title – display block name, that will be shown in the blocks inserter
- Slug – unique string that identifies your block. A block name can only contain lowercase alphanumeric characters and dashes and must begin with a letter
- Icon – help users identify your block. Available only Dashicons.
- Category – help users find your block. There are some default categories, but you also able to create your own category simply by pressing Enter
- Keywords – block aliases that help users discover it while searching. For example, an "image" block could also want to be discovered by "photo". It is only allowed to add as much as three terms per block.
- Description – short description for your block, that will be shown in the block inspector
- Styles – additional block styles for user to choose from
- Supports
- Multiple – allow use block multiple times on the page
- Class Name – additional field to add custom class name
- Anchor – additional field to add block ID attribute
- Inserter – show block in blocks inserter
- Reusable – allow converting block into reusable block
- Lock – allow block locking/unlocking by a user
- Align – adds block controls that allow changing the block's alignment. By default added "wide" and "full" alignments, but make sure your theme supports it
- Supports Ghost Kit – support for Ghost Kit extensions
- Condition – post types in which this block will be showed. If no post types selected, the block will be shown everywhere