Section Builder field
Purpose
A page builder field: editors stack sections of different kinds ("Hero", "Text and image", "Quote"), each with its own sub-fields. Sections open and close like Collection items: an arrow at the end of each, and Collapse all / Expand all above the list.
Field type name
section_builder
Settings
| Setting | Description |
|---|---|
| Instructions | Help text for editors, shown with the field. |
| Button Label | Text of the "Add Section" button. |
| Minimum Sections | Editors must add at least this many sections. Empty = no minimum. |
| Maximum Sections | Editors cannot add more sections. Empty = no limit. |
| Translation | How the field behaves in other languages: translate, copy, copy_once or do_not_translate. Used on top-level fields when WPML is active. See WPML. |
| Width | Width on edit screens, to place fields side by side: 100 (full), 75, 66, 50, 33 or 25 (%). Phones always show full width. |
| Label per language | The label and instructions per language code while editing in that language, e.g. {"nl": {"label": "Prijs"}}. Set on the Translation tab when WPML is active. See WPML. |
PHP return value
A list of rows; each row is [ '_section' => 'hero', …sub-field values ]. null when there are no rows.
Example
foreach ( cafe_rows( 'page_sections' ) as $section ) {
get_template_part( 'sections/' . $section->section(), null, [ 'section' => $section ] );
}
// sections/hero.php:
$section = $args['section'];
echo esc_html( $section->get( 'heading' ) );