Skip to content

Blocks

Pages are core blocks and patterns. A custom block exists only when a core block cannot express the component. The block still renders when an optional plugin is missing.

  1. A core block, plus a block style registered on that block for a visual variant.

    functions.php
    register_block_style( 'core/button', array(
    'name' => 'brand',
    'label' => 'Brand',
    ) );
  2. A pattern: registered markup made of those blocks, which an editor inserts whole.

  3. A custom block, as a directory with a manifest and a render template.

    blocks/text-and-image/
    block.json
    render.php
    block.json
    {
    "name": "theme/text-and-image",
    "title": "Text and image",
    "render": "file:./render.php",
    "supports": { "html": false, "align": ["full"] }
    }

Registration walks blocks/*/block.json. A hand-maintained list drifts from the folders.

supports.html is false when the block owns its markup. align is limited when the block owns its width.

Field groups are JSON in the theme (acf-json/ or the plugin’s equivalent), named after the block. A hash filename is harder to review. render.php reads the fields and passes them to a template part. Output is escaped. A heading component takes the level as an argument. It does not always print h2, and it does not echo raw editor HTML.

A plugin function is guarded. The template still renders when the function is missing:

render.php
$heading = '';
if ( function_exists( 'get_field' ) ) {
$heading = (string) get_field( 'heading' );
}

The same guard covers have_rows(), the_field(), and any other plugin API. A block that means nothing without that plugin has the plugin in the image. It is not an optional activation.

A classic theme may use PHP for the document shell. A numbered template per campaign (01-hero.php, 02-pricing.php) is a second composition model beside the blocks. A block theme does not call remove_theme_support( 'block-templates' ). That call belongs only to a classic theme that uses blocks inside post content and nowhere else.