GCBGutenberg
Control Blocks
v1.3.3
Buy

Layout grid

Boxes on a grid, arranged by hand. Drag each box where it goes and how big it is, and put any blocks inside.

A grid your client arranges by hand. They drag each box to where it goes and how big it is, and put any blocks inside: your own styled blocks as well as WordPress's. It does the job of columns without the columns, and makes a bento layout something a client can rearrange.

Recorded in the editor: type /frame and /cta into the boxes, then drag a corner and the call to action grows into a banner.

Download example A zip of block folders for your theme. Needs GCB 1.3.1 or later, and nothing else.

What's in the download

  • layout/ The grid. A layout field stores where every box sits, for desktop and for phones.
  • layout-box/ One box. Any blocks inside, with an optional background picture, video or colour.

Each folder is an ordinary GCB block: block.json, block.fields.json and render.php, plus a style.css and a view.js where it needs them. There is no build step and no library.

How it's built

The grid is one field of the layout type. The editor draws it as a board your client drags boxes on, and the template turns the stored positions into CSS grid placement. The boxes themselves are child blocks, marked with a <Repeater>.

layout/render.php
<Repeater  allowedBlocks='["gcb/layout-box"]'  addButtonLabel="Add box"  min="1"  max="48"  editLayout="grid"/>

Its fields, from block.fields.json:

FieldType
Layoutlayout
Gaprange

There is no script: the page is CSS grid.

Use it

  1. Unzip the download.
  2. Copy layout/ and layout-box/ into your theme's blocks/ folder.
  3. Reload the block editor. The block is in the inserter.

That's all of it. You don't register the block: there's no register_block_type() call and nothing to add to functions.php. GCB registers every folder in your theme's blocks/ folder by itself.

It is your block now. Change the markup, the fields or the script to suit the design. The docs cover every field type and marker used here.

More examples: all examples, or download them together as the GCB Kit.

Build anything in the block editor

Every licence includes all features and a year of updates and support.

Buy GCB from $8.25 a month See pricing