Blocks Creation

You can create blocks to work with custom meta fields (that will be available from the PHP code) as well as blocks with output HTML and show it in your site content.

  • Navigate to WordPress Admin > Lazy Blocks
  • Click Add New button

Block Edit Screen

On this screen you can configure your block.

Main section:

  • Title – display block name, that will be shown in the blocks inserter
  • Controls – controls to manage your block options. The full description read on this page
  • Code – custom HTML + Handlebars syntax, which you can use to output data from block controls. See examples page for more info.
    • Frontend HTML – code, that will be showed 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 HTML – code, that will be showed in the editor on your block

Secondary section:

  • 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
  • Description – short description for your block, that will be shown in the block inspector
  • 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.
  • Supports
    • Multiple – allow inserting block multiple or one time only (when disabled)
    • Class Name – adds a field to define a custom class name for the block’s wrapper
    • Anchor – adds a field to define an id for the block and a button to copy the direct link
    • Show in Blocks Inserter – by default, all blocks will appear in the Gutenberg inserter. Disable this option to hide block so it can only be inserted programmatically
  • Align – adds block controls which allow changing block’s alignment. By default added ‘wide’ and ‘full’ alignments, but make sure your theme supports it
  • Condition – post types in which this block will be showed. If no post types selected, the block will be shown everywhere
Was this page helpful?