Overview
The Section field renders a horizontal rule with an optional heading and description text — no input, no saved value. It is purely for layout and visual organization inside the options panel. Use it to divide a long section into named sub-groups, create visual breathing room between unrelated fields, or label a cluster of related settings without creating a separate navigation section.
Field Registration
php
[
'id' => 'colors_divider',
'type' => 'section',
'title' => __('Brand Colors', 'your-textdomain'),
'desc' => __('Core colors used throughout the theme.', 'your-textdomain'),
]
Field Options
| Option | Type | Required | Description |
|---|---|---|---|
id | string | ✅ | Unique field identifier — not stored, but required for internal rendering |
type | string | ✅ | Must be section |
title | string | — | Heading text displayed beside the divider line |
desc | string | — | Optional subtext shown below the heading |
required | array | — | Conditional logic rules — see Conditional Logic |
Return Value
None. The Section field stores no value and returns nothing from themeplus_get_option().
Usage Examples
Simple divider with a title
php
[
'id' => 'heading_colors_divider',
'type' => 'section',
'title' => __('Heading Colors', 'your-textdomain'),
],
[
'id' => 'h1_color',
'type' => 'color',
'title' => __('H1 Color', 'your-textdomain'),
'default' => '#0a0a0a',
],
[
'id' => 'h2_color',
'type' => 'color',
'title' => __('H2 Color', 'your-textdomain'),
'default' => '#1a1a1a',
],
Divider with title and description
php
[
'id' => 'footer_widgets_divider',
'type' => 'section',
'title' => __('Footer Widget Areas', 'your-textdomain'),
'desc' => __('Configure the widget columns displayed in the footer above the copyright bar.', 'your-textdomain'),
],
Organizing a long section into sub-groups
php
themeplus_add_section([
'id' => 'header',
'title' => __('Header', 'your-textdomain'),
'icon' => 'fa-solid fa-rectangle-ad',
'fields' => [
[
'id' => 'general_divider',
'type' => 'section',
'title' => __('General', 'your-textdomain'),
],
[
'id' => 'header_layout',
'type' => 'button_set',
'title' => __('Header Layout', 'your-textdomain'),
'default' => 'standard',
'options' => [
'standard' => __('Standard', 'your-textdomain'),
'centered' => __('Centered', 'your-textdomain'),
'minimal' => __('Minimal', 'your-textdomain'),
],
],
[
'id' => 'sticky_header',
'type' => 'toggle',
'title' => __('Sticky Header', 'your-textdomain'),
'default' => true,
],
[
'id' => 'colors_divider',
'type' => 'section',
'title' => __('Colors', 'your-textdomain'),
],
[
'id' => 'header_bg_color',
'type' => 'color',
'title' => __('Background Color', 'your-textdomain'),
'default' => '#ffffff',
],
[
'id' => 'header_text_color',
'type' => 'color',
'title' => __('Text Color', 'your-textdomain'),
'default' => '#1e1e1e',
],
[
'id' => 'typography_divider',
'type' => 'section',
'title' => __('Typography', 'your-textdomain'),
],
[
'id' => 'nav_typography',
'type' => 'typography',
'title' => __('Navigation Font', 'your-textdomain'),
],
],
]);
With a conditional — show divider only when a feature is enabled
php
[
'id' => 'enable_mega_menu',
'type' => 'toggle',
'title' => __('Enable Mega Menu', 'your-textdomain'),
'default' => false,
],
[
'id' => 'mega_menu_divider',
'type' => 'section',
'title' => __('Mega Menu Settings', 'your-textdomain'),
'required' => ['enable_mega_menu', '==', true],
],
[
'id' => 'mega_menu_columns',
'type' => 'button_set',
'title' => __('Columns', 'your-textdomain'),
'default' => '4',
'options' => ['2' => '2', '3' => '3', '4' => '4'],
'required' => ['enable_mega_menu', '==', true],
],
Notes
- The
idmust still be unique within the section even though the field stores no value. - Section fields are best used inside long sections to break fields into logical sub-groups — if a group is large enough to warrant its own navigation entry, create a separate section using
themeplus_add_section()instead. - Unlike the Info field, the Section field is intended purely as a visual divider — use Info for instructional notices and warnings.