Skip to content

WordPress Custom Blocks Without React

Define the fields, write the markup, and your block sits in the editor next to the core ones.

What a Custom Block Is

A block you define: a name in the inserter, the fields an editor fills in, and the HTML that ends up on the page. A pricing table, a testimonial, a call to action, a map with your own defaults.

Most sites need a handful of them. The layout that repeats across landing pages. The callout an editor rebuilds by hand every time. The card grid that has to look the same on all forty pages, and does not.

The usual alternatives age badly. A shortcode nobody remembers the arguments for. An HTML block that breaks the first time a colleague edits it. A page builder that owns your markup and will not give it back.

A custom block stays a WordPress block. The values live in the post, the markup is the one you wrote, and an editor who has never opened the builder picks it from the inserter like any other block.

Three Ways to Build One

All three ship a working block. They differ in what you maintain afterwards.

React and a Build Step

@wordpress/create-block scaffolds a plugin with JavaScript, a bundler and a package.json. Full control over the editor, and a toolchain to keep alive.

Registration in PHP

Register the block in PHP and render it from a template. No React, but the field interface is yours to write or to bring from another plugin.

A Visual Builder

Describe the block in the builder: name, icon, controls. Lazy Blocks registers it and renders your template with the values an editor typed in.

How It Works

Build the block once in the builder, then use it like any other block.

1

Describe the Block

A title, an icon, a category, and the post types where editors can use it.

2

Add the Controls

Around thirty of them, from a text field to galleries and repeaters. Each one becomes an attribute.

3

Write the Output

HTML with Handlebars for a static block, PHP when it has to run a query.

Block controls in the Lazy Blocks builder

What Comes With It

The free plugin covers everything below. The documentation has the details.

  • Around Thirty Controls
    Text, textarea, image, gallery, file, color picker, range, select, checkbox, date, code editor, repeater and inner blocks.
  • PHP and Handlebars Output
    Write plain HTML for a static block, or PHP when it has to run a query.
  • Templates in Your Theme
    Keep block markup in theme files, under version control with the rest of your code.
  • Values in Post Meta
    Saved control values are readable from post meta, so your theme can use them outside the block.
  • Your Own Controls
    Register a control type of your own when the built-in set does not cover what a block needs.
  • Export to PHP or JSON
    Move a block to another site, or commit it to a theme or plugin.
  • Hooks for Developers
    PHP and JavaScript filters cover registration, rendering and the control interface.
  • WPML Support
    Text controls are translatable, so a block works on a multilingual site.

What People Say

Reviews from the WordPress.org plugin page.

Brian Shim photo
Brian Shim

This plugin is the best one I've found for creating your own Gutenberg blocks. Really great, thank you!

kalsdura photo
kalsdura

I am less of a funky javascript guy but more of oldschool php person and this plugin with php has made my work extremely easy!

agent617 photo
agent617

If you're a front-end developer looking for a completely `practical` integration solution for your custom templates/themes, this is a MUST HAVE!

Questions

Do I need to know React to build a custom block?
No. You describe the block in the builder and write its output as HTML with Handlebars or as PHP. There is no build step and no JavaScript project to maintain.
Where does the block markup live?
Either in the block settings or in a file in your theme. Point a block at a theme template and the markup goes through code review and version control like the rest of your theme.
Will the blocks work with my theme?
A Lazy Blocks block is a normal WordPress block, so it appears in the inserter next to the core ones and works in the post editor and in the site editor. The markup is yours, so it inherits whatever your theme already styles.
Can I move blocks to another site?
Yes. Blocks export to PHP or JSON, so you can commit them to a theme or a plugin and install them on the next project.
What does the Pro version add?
Conditional logic between controls, Posts, Taxonomy and Users controls, block preloading in the editor, and Rich Text editing on the canvas. The free versus Pro comparison lists everything side by side.

Let's Get Started

Download Lazy Blocks for your next Block-based WordPress project.

View Pricing