Before any Field array is written, which will represent the individual options on the options panel, a section must be created. The section array sets up a tab on the side of the Redux options panel, where the Field arrays will ultimately go.

The setSections function

Section arrays are declared in the setSections function of your config file, or by default, sample-config.php. To see for yourself, open the sample-config.php file in your favorite PHP editor and scroll down to the setSections function. In addition to section arrays, and code your section might depend on should also be placed here. As seen in the sample-config file, there is a section of code toward the top which enumerates image files in the sample/patterns directory for use in image_select field example.

To set up a new section, we need to pass the entire section code into the public sections array of the Redux_Framework_sample_config class. To begin, use the code below:

$this->sections[] = array(
    'title' => 'New Section',

Set the title argument to whatever you would like to name the section. Whatever title you choose will be the title that appears on the actual section tab of the options framework. Use the arguments listed below to further set the section arguments.


Name Type Default Description.
icon string The icon to be displayed next to the section title. This could be a preset Elusive Icon or a URL to an icon of your own.
icon_type string Set to image when using a custom URL to an icon.
title string The title of the section that will appear on the option tab.
heading string Text to appear at the top of the section page. By default the title argument is used as the title. Text specified via this argument replaces it.
desc string Text to appear under the section title. HTML is permitted.
class string Appends any number of classes to the section’s class attribute.
permissions string String specifying the capability required to view the section.  See Using Permissions.
customizer_only array An array of arrays representing individual options.
subsection bool Boolean to denote if this section should appear as a subsection to the previously defined section.

Here is an example of a typical sections array with a single text box option:

$this->sections[] = array(
    'title'   => 'New Section',
    'icon'    => 'el-icon-cogs',
    'heading' => 'Expanded New Section Title',
    'desc'    => '<br />This is the section description.  HTML is permitted.<br />',
    'fields'  => array(
            'id'    => 'opt-text',
            'type'  => 'text',
            'title' => 'A sample text box',

Comments are closed.