For the complete documentation index, see llms.txt. This page is also available as Markdown.

Introduction

Build custom server-rendered Gutenberg blocks with TWIG templates and ACPT fields

Dynamic Blocks let you create fully custom, server-rendered Gutenberg blocks powered by TWIG templates. Unlike static blocks that save HTML to the database, dynamic blocks are rendered on every page load — which means they always reflect the latest data from your ACPT meta fields.


What you can build

Dynamic Blocks are ideal for any situation where you need a reusable block that displays custom field data:

  • Post cards — show a title, featured image, and excerpt from related posts

  • Event listings — display date, location, and registration links from ACPT fields

  • Property cards — render price, address, gallery, and amenities from meta boxes

  • Pricing tables — output dynamic plans driven by custom fields

  • Author bios — pull avatar, name, and bio from user meta

  • Configurable banners — let editors control text, color, and CTA from the block sidebar


How it works

Block Editor sidebar controls
         │
         ▼
   TWIG callback template
         │  (variables: controls + ACPT fields + WP globals)
         ▼
   PHP render_callback
         │
         ▼
   HTML output on the page

When a block is placed in the editor, WordPress calls the block's render_callback. ACPT passes the block's control values and all ACPT meta fields for the current post into a TWIG environment, renders your template, and returns the HTML.


Prerequisites

Dynamic Blocks must be enabled before they appear in the admin menu.

Go to Settings → Content settings and toggle Enable dynamic blocks.


In this section

Page
What it covers

Step-by-step walkthrough of the block creation wizard

All variables, functions, filters, and control-flow syntax available in templates

All 11 control types and how to use them in TWIG

Three complete, real-world block examples

Last updated