Section field
Purpose
One kind of section of a Section Builder ("Hero", "Quote", …) holding that kind's sub-fields. Created in the Section Builder editor of the builder.
Field type name
section
Settings
| Setting | Description |
|---|---|
| Instructions | Help text for editors, shown with the field. |
| Layout | How the sub-fields are arranged for editors. Options: block (Block (fields below each other)), table (Table (fields side by side)), row (Row (labels on the left)). |
| Minimum | Editors must add this section at least this many times. Empty = no minimum. |
| Maximum | Editors can add this section at most this many times. Empty = no limit. |
| 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
No value of its own; its name is the _section of the rows that use it.
Example
// Section "quote" with sub-fields "text" and "author":
if ( 'quote' === $section->section() ) {
printf( '<blockquote>%s<cite>%s</cite></blockquote>', esc_html( $section->get( 'text' ) ), esc_html( $section->get( 'author' ) ) );
}