Class: WP_Customize_Section

Customize Section class.

A UI container for controls, managed by the WP_Customize_Manager class.


Properties

Name Type(s) Default Value Summary
instance_count integer Static ⋅ Incremented with each new class instantiation, then stored in $instance_number.

Used when sorting two instances whose priorities are equal.

instance_number integer Order in which this instance was created in relation to other instances.
manager WP_Customize_Manager WP_Customize_Manager instance.
id string Unique identifier.
priority integer Priority of the section which informs load order of sections.
panel string Panel in which to show the section, making it a sub-section.
capability string Capability required for the section.
theme_supports string | array Theme feature support for the section.
title string Title of the section to show in UI.
description string Description to show in the UI.
controls array Customizer controls for this section.
type string Type of this section.
active_callback callable Active callback.
description_hidden boolean Show the description or hide it behind the help icon.

Methods

WP_Customize_Section:: __construct( WP_Customize_Manager $manager, string $id, array $args = array() )

Constructor. Since 3.4.0.

Any supplied $args override class property defaults.

Arguments

Name Type(s) Default Value Description
$manager WP_Customize_Manager

Customizer bootstrap instance.

$id string

An specific ID of the section.

$args array

Section arguments.


WP_Customize_Section:: active( )

Check whether section is active to current Customizer preview. Since 4.1.0.

Returns

boolean

Whether the section is active to the current preview.


WP_Customize_Section:: active_callback( )

Default callback used when invoking WP_Customize_Section::active(). Since 4.1.0.

Subclasses can override this with their specific logic, or they may provide an 'active_callback' argument to the constructor.

Returns

true

Always true.


WP_Customize_Section:: check_capabilities( )

Checks required user capabilities and whether the theme has the feature support required by the section. Since 3.4.0.

Returns

boolean

False if theme doesn't support the section or user doesn't have the capability.


WP_Customize_Section:: get_content( )

Get the section's content for insertion into the Customizer pane. Since 4.1.0.

Returns

string

Contents of the section.


WP_Customize_Section:: json( )

Gather the parameters passed to client JavaScript via JSON. Since 4.1.0.

Returns

array

The array to be exported to the client as JSON.


WP_Customize_Section:: maybe_render( )

Check capabilities and render the section. Since 3.4.0.


WP_Customize_Section:: print_template( )

Render the section's JS template. Since 4.3.0.

This function is only run for section types that have been registered with WP_Customize_Manager::register_section_type().


WP_Customize_Section:: render( )

Render the section UI in a subclass. Since 3.4.0.

Sections are now rendered in JS by default, see WP_Customize_Section::print_template().


WP_Customize_Section:: render_template( )

An Underscore (JS) template for rendering this section. Since 4.3.0.

Class variables for this section class are available in the data JS object; export custom variables by overriding WP_Customize_Section::json().


WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.