Examples
Three complete dynamic block examples with controls, TWIG templates, and CSS
These examples demonstrate real-world dynamic blocks. Each one includes the controls to configure, the TWIG callback template, and a CSS block for the Step 5 Style tab.
Example 1 — Event Card
A card that displays an event's key details, with an optional featured badge controlled by the editor.
Meta box setup
Assumes a meta box named event_details with the following fields on the event post type:
date
Date
acpt_event_details_date
time
Time
acpt_event_details_time
location
Text
acpt_event_details_location
description
Editor
acpt_event_details_description
ticket_url
URL
acpt_event_details_ticket_url
Block controls
show_badge
Toggle
off
badge_label
Text
Featured
Callback (TWIG)
<article class="event-card">
{% if show_badge %}
<span class="event-card__badge">
{{ badge_label|default('Featured') }}
</span>
{% endif %}
<div class="event-card__body">
<h2 class="event-card__title">
<a href="{{ get_permalink() }}">{{ get_the_title()|raw }}</a>
</h2>
{% if acpt_event_details_date %}
<p class="event-card__meta">
📅 {{ acpt_event_details_date }}
{% if acpt_event_details_time %}
at {{ acpt_event_details_time }}
{% endif %}
</p>
{% endif %}
{% if acpt_event_details_location %}
<p class="event-card__meta">
📍 {{ acpt_event_details_location }}
</p>
{% endif %}
{% if acpt_event_details_description %}
<div class="event-card__description">
{{ acpt_event_details_description|raw }}
</div>
{% endif %}
{% if acpt_event_details_ticket_url %}
<a class="event-card__cta" href="{{ acpt_event_details_ticket_url }}">
Get tickets →
</a>
{% else %}
<a class="event-card__cta event-card__cta--secondary" href="{{ get_permalink() }}">
Learn more →
</a>
{% endif %}
</div>
</article>Style (CSS)
Example 2 — Property Listing Card
A card for a real estate listing. Displays the property's gallery, price, address, and key specs — all driven by ACPT meta fields, with no custom controls needed.
Meta box setup
Assumes a meta box named property on post type listing:
gallery
Gallery
acpt_property_gallery (array of image URLs)
price
Number
acpt_property_price
currency
Select
acpt_property_currency
address
Address
acpt_property_address (object)
bedrooms
Number
acpt_property_bedrooms
bathrooms
Number
acpt_property_bathrooms
area_sqm
Number
acpt_property_area_sqm
Block controls
None — this block is fully data-driven.
Callback (TWIG)
Style (CSS)
Example 3 — Configurable Text Banner
A flexible banner block where the editor can set the message text, pick an accent colour, and toggle a call-to-action button — all from the block sidebar.
Meta box setup
No ACPT meta fields needed. This block is entirely control-driven.
Block controls
message
Textarea
—
accent_color
Select
blue / green / orange / dark
show_cta
Toggle
off
cta_label
Text
Learn more
cta_url
Text
—
Callback (TWIG)
Style (CSS)
Going further
TWIG reference — complete variable and function documentation
Block controls — all 11 control types explained
save_acpt_block — create blocks programmatically via PHP
Last updated