* @license http://www.gnu.org/licenses/gpl-2.0.html * @link https://github.com/maddisondesigns */ class Astha_Toggle_Switch_Custom_control extends WP_Customize_Control { /** * The type of control being rendered */ public $type = 'toggle_switch'; /** * Enqueue our scripts and styles */ public function enqueue(){ wp_enqueue_style( 'astha-customizer-css', ASTHA_CUSTOMIZER_CSS, array(), '1.0', 'all' ); } /** * Render the control in the customizer */ public function render_content(){ $attr = array(); foreach( $this->choices as $each_val ){ $attr[] = $each_val; } //echo($this->value()); ?>
link(); checked( $this->value() ); ?>>
label ); ?> description ) ) { ?> description ); ?>
label ) ) { ?> label ); ?> description ) ) { ?> description ); ?> choices as $key => $value ) { ?>
value()); ?>
label ) ): ?>

label ); ?>

logo ) ): ?> description ) ): ?>

description ); ?>

link ) ): ?> Get Help
* @license http://www.gnu.org/licenses/gpl-2.0.html * @link https://github.com/maddisondesigns */ class Astha_Select2_Custom_Control extends WP_Customize_Control { /** * The type of control being rendered */ public $type = 'dropdown_select2'; /** * The type of Select2 Dropwdown to display. Can be either a single select dropdown or a multi-select dropdown. Either false for true. Default = false */ private $multiselect = false; /** * The Placeholder value to display. Select2 requires a Placeholder value to be set when using the clearall option. Default = 'Please select...' */ private $placeholder = 'Please select...'; /** * Constructor */ public function __construct( $manager, $id, $args = array(), $options = array() ) { parent::__construct( $manager, $id, $args ); // Check if this is a multi-select field if ( isset( $this->input_attrs['multiselect'] ) && $this->input_attrs['multiselect'] ) { $this->multiselect = true; } // Check if a placeholder string has been specified if ( isset( $this->input_attrs['placeholder'] ) && $this->input_attrs['placeholder'] ) { $this->placeholder = $this->input_attrs['placeholder']; } } /** * Enqueue our scripts and styles */ public function enqueue() { wp_enqueue_script( 'astha-select2-js', ASTHA_CUSTOMIZER_URI . 'assets/js/select2.full.min.js', array( 'jquery' ), '4.0.13', true ); wp_enqueue_script( 'astha-custom-controls-js', ASTHA_CUSTOMIZER_URI . 'assets/js/customizer.js', array( 'astha-select2-js' ), '1.0', true ); wp_enqueue_style( 'astha-custom-controls-css', ASTHA_CUSTOMIZER_URI . 'assets/css/customizer.css', array(), '1.1', 'all' ); wp_enqueue_style( 'astha-select2-css', ASTHA_CUSTOMIZER_URI . 'assets/css/select2.min.css', array(), '4.0.13', 'all' ); } /** * Render the control in the customizer */ public function render_content() { $defaultValue = $this->value(); if ( $this->multiselect ) { $defaultValue = explode( ',', $this->value() ); } ?>