customizer

Display a section inside the theme customizer for performing live styling changes for a theme.

[zilla_alert]Some options inside theme customizer sections have the ability to change elements in the theme for live previewing of changes. Refer to Livepreview for more details on that feature for options.[/zilla_alert]

How to Create

Can be created from TitanFramework Instance:

$titan = TitanFramework::getInstance( 'my-theme' );
$section = $titan->createThemeCustomizerSection( array(
'name' => 'My Section',
) );
// Create options in My Section
$section->createOption( ... );

[zilla_alert]This will create a theme customizer section (accordion tab) named ‘My Section’ in the middle of the section list.[/zilla_alert]

Settings / Parameters

Parameter Type Description
name string The name of the theme customizer section. This is the name shown in the accordion tab for this section. As of v1.7.1, you can use the names of existing WordPress sections to append options to them.A list of existing WordPress sections:
title_tagline
colors
background_image
nav
static_front_page
panel string (Optional) The name of parent panel to create. Available starting v1.7.1. Use this if you want your section to be included inside a panel. You can use the same name of panels in other create calls to add multiple sections to the same panel.
desc string (Optional) A description to display inside the section when it is open.
capability string (Optional) The required capability of the user to edit the options in this section. Defaults to edit_theme_options
position int (Optional) The position order of this section against the other sections. A lower number puts this near the top of the list. Defaults to 30

[zilla_alert]Some options inside theme customizer sections have the ability to change elements in the theme for live previewing of changes. Refer to Livepreview for more details on that feature for options.[/zilla_alert]

Examples

Creating multiple sections inside a single panel:

$titan = TitanFramework::getInstance( 'my-theme' );
$section1 = $titan->createThemeCustomizerSection( array(
'name' => 'Section 1',
'panel' => 'My Panel',
) );
// Create options for Section 1
$section1->createOption( ... );
$section2 = $titan->createThemeCustomizerSection( array(
'name' => 'Section 2',
'panel' => 'My Panel',
) );
// Create options for Section 2
$section2->createOption( ... );

Adding a new option inside the Site Title & Tagline section:

$titan = TitanFramework::getInstance( 'my-theme' );
$section = $titan->createThemeCustomizerSection( array(
'id' => 'title_tagline',
) ); 
// Create options that will appear 
$section->createOption( ... );