Class: WP_Customize_Panel

Customize Panel class.

A UI container for sections, managed by the WP_Customize_Manager.


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 panel, defining the display order of panels and sections.
capability string Capability required for the panel.
theme_supports string | array Theme feature support for the panel.
title string Title of the panel to show in UI.
description string Description to show in the UI.
auto_expand_sole_section boolean Auto-expand a section in a panel when the panel is expanded when the panel only has the one section.
sections array Customizer sections for this panel.
type string Type of this panel.
active_callback callable Active callback.

Methods

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

Constructor. Since 4.0.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 for the panel.

$args array

Panel arguments.


WP_Customize_Panel:: active( )

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

Returns

boolean

Whether the panel is active to the current preview.


WP_Customize_Panel:: active_callback( )

Default callback used when invoking WP_Customize_Panel::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

boolean

Always true.


WP_Customize_Panel:: check_capabilities( )

Checks required user capabilities and whether the theme has the feature support required by the panel. Since 4.0.0.

Returns

boolean

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


WP_Customize_Panel:: content_template( )

An Underscore (JS) template for this panel's content (but not its container). Since 4.3.0.

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


WP_Customize_Panel:: get_content( )

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

Returns

string

Content for the panel.


WP_Customize_Panel:: 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_Panel:: maybe_render( )

Check capabilities and render the panel. Since 4.0.0.


WP_Customize_Panel:: print_template( )

Render the panel's JS templates. Since 4.3.0.

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


WP_Customize_Panel:: render( )

Render the panel container, and then its contents (via `this->render_content()`) in a subclass. Since 4.0.0.

Panel containers are now rendered in JS by default, see WP_Customize_Panel::print_template().


WP_Customize_Panel:: render_content( )

Render the panel UI in a subclass. Since 4.1.0.

Panel contents are now rendered in JS by default, see WP_Customize_Panel::print_template().


WP_Customize_Panel:: render_template( )

An Underscore (JS) template for rendering this panel's container. Since 4.3.0.

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


WordPress Developer Newsletter

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