WP_Customize_Manager::add_control()
Adds a customize control.
Метод класса: WP_Customize_Manager{}
Хуков нет.
Возвращает
WP_Customize_Control
. The instance of the control that was added.
Использование
$WP_Customize_Manager = new WP_Customize_Manager(); $WP_Customize_Manager->add_control( $id, $args );
- $id(WP_Customize_Control|строка) (обязательный)
- Customize Control object, or ID.
- $args(массив)
- Array of properties for the new Control object. See WP_Customize_Control::__construct() for information on accepted arguments.
По умолчанию: empty array
Заметки
- Смотрите: WP_Customize_Control::__construct()
Список изменений
С версии 3.4.0 | Введена. |
С версии 4.5.0 | Return added WP_Customize_Control instance. |
Код WP_Customize_Manager::add_control() WP Customize Manager::add control WP 6.5.2
public function add_control( $id, $args = array() ) { if ( $id instanceof WP_Customize_Control ) { $control = $id; } else { $control = new WP_Customize_Control( $this, $id, $args ); } $this->controls[ $control->id ] = $control; return $control; }