add_setting( 'show_site_title_tagline', array( * 'default' => FALSE, * 'sanitize_callback' => 'absint', * ) ); * * $wp_customize->add_control( new Beetan_Customize_Toggle_Control( $wp_customize, 'show_site_title_tagline', array( * 'label' => esc_html__( 'Display Site Title and Tagline', 'beetan' ), * 'section' => 'title_tagline', * 'description' => esc_html__( 'Description', 'beetan' ), * 'required' => array( * 'abcd' * ) * ) ) ); */ if ( ! class_exists( 'Beetan_Customize_Toggle_Control' ) ): class Beetan_Customize_Toggle_Control extends WP_Customize_Control { public $type = 'toggle'; private $extras = array(); private $required = array(); public function __construct( $manager, $id, $args = array() ) { parent::__construct( $manager, $id, $args ); $this->extras = isset( $args[ 'extras' ] ) ? $args[ 'extras' ] : array(); $this->required = isset( $args[ 'required' ] ) ? $args[ 'required' ] : array(); if ( ! isset( $this->extras[ 'id' ] ) ) { $this->extras[ 'id' ] = $id; } } public function to_json() { parent::to_json(); $this->json[ 'extras' ] = $this->extras; $this->json[ 'required' ] = $this->required; } public function enqueue() { $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; wp_enqueue_style( 'customize-toggle-control', esc_url( get_theme_file_uri( "/assets/css/customize-toggle-control$suffix.css" ) ) ); wp_enqueue_style( 'customize-toggle-control', esc_url( get_theme_file_uri( "/assets/js/customize-toggle-control$suffix.js" ) ) ); } protected function render_content() { ?>
description ) ) : ?> description ); ?>