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

Constructor.


Description

Any supplied $args override class property defaults.


Top ↑

Parameters

$manager WP_Customize_Manager Required
Customizer bootstrap instance.
$id string Required
A specific ID of the section.
$args array Optional
Array of properties for the new Section object.
  • priorityint
    Priority of the section, defining the display order of panels and sections. Default 160.
  • panelstring
    The panel this section belongs to (if any).
  • capabilitystring
    Capability required for the section.
    Default 'edit_theme_options'
  • theme_supportsstring|string[]
    Theme features required to support the section.
  • titlestring
    Title of the section to show in UI.
  • descriptionstring
    Description to show in the UI.
  • typestring
    Type of the section.
  • active_callbackcallable
    Active callback.
  • description_hiddenbool
    Hide the description behind a help icon, instead of inline above the first control.
    Default false.

Default: array()


Top ↑

Source

File: wp-includes/class-wp-customize-section.php. View all references

public function __construct( $manager, $id, $args = array() ) {
	$keys = array_keys( get_object_vars( $this ) );
	foreach ( $keys as $key ) {
		if ( isset( $args[ $key ] ) ) {
			$this->$key = $args[ $key ];
		}
	}

	$this->manager = $manager;
	$this->id      = $id;
	if ( empty( $this->active_callback ) ) {
		$this->active_callback = array( $this, 'active_callback' );
	}
	self::$instance_count += 1;
	$this->instance_number = self::$instance_count;

	$this->controls = array(); // Users cannot customize the $controls array.
}


Top ↑

Changelog

Changelog
Version Description
3.4.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 2 content
    Contributed by Andrea Alba

    In case you want to change the location of your Panel (or Section), these are the priorities of the core sections:

    Site Title & Tagline (title_tagline): 20
    Colors (colors): 40
    Header Image (header_image): 60
    Background Image (background_image): 80
    Menus (Panel) (nav_menus): 100
    Widgets (Panel) (widgets): 110
    Static Front Page (static_front_page): 120
    default: 160
    Additional CSS (custom_css): 200

You must log in before being able to contribute a note or feedback.