Current Path : /storage/v11800/affypharma/public_html/wp-content/themes/amberd-online-store/inc/customizer/ |
Linux v11800 5.3.0-1023-aws #25~18.04.1-Ubuntu SMP Fri Jun 5 15:19:18 UTC 2020 aarch64
|
Current File : /storage/v11800/affypharma/public_html/wp-content/themes/amberd-online-store/inc/customizer/custom-controls.php |
<?php
##################------ Custom controls ------##################
if ( class_exists( 'WP_Customize_Control' ) ) {
class amberd_Section_Premium extends WP_Customize_Section {
public $type = 'amberd-buy-premium';
public $pro_text = '';
public $pro_url = '';
public function json() {
$json = parent::json();
$json['pro_text'] = $this->pro_text;
$json['pro_url'] = esc_url( $this->pro_url );
return $json;
}
protected function render_template() { ?>
<li id="accordion-section-{{ data.id }}" class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
<h3 class="accordion-section-title">
{{ data.title }}
<# if ( data.pro_text && data.pro_url ) { #>
<a href="{{ data.pro_url }}" class="amberd-premium-action-button amberd-pro-button-style" target="_blank">{{ data.pro_text }}</a>
<# } #>
</h3>
</li>
<?php }
}
class Amberd_Toggle_Switch_Custom_control extends WP_Customize_Control {
public $type = 'amberd_toggle_switch';
public function enqueue(){
wp_enqueue_style( 'amberd-theme-custom-controls', get_template_directory_uri().'/inc/customizer/css/customizer.css');
wp_enqueue_script('amberd-customizer-js', get_theme_file_uri('/inc/customizer/js/customizer.js'), array('jquery'), '1.0', true);
}
public function render_content(){
?>
<div class="toggle-switch-control">
<div class="toggle-switch">
<input type="checkbox" id="<?php echo esc_attr($this->id); ?>" name="<?php echo esc_attr($this->id); ?>" class="toggle-switch-checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?>>
<label class="toggle-switch-label" for="<?php echo esc_attr( $this->id ); ?>">
<span class="toggle-switch-inner"></span>
<span class="toggle-switch-switch"></span>
</label>
</div>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php if( !empty( $this->description ) ) { ?>
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
<?php } ?>
</div>
<?php
}
}
class Amberd_Slider_Custom_Control extends WP_Customize_Control {
public $type = 'amberd_slider_control';
public function render_content() {
?>
<div class="slider-custom-control">
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span><input type="number" id="<?php echo esc_attr( $this->id ); ?>" name="<?php echo esc_attr( $this->id ); ?>" value="<?php echo esc_attr( $this->value() ); ?>" class="customize-control-slider-value" <?php $this->link(); ?> />
<div class="slider" slider-min-value="<?php echo esc_attr( $this->input_attrs['min'] ); ?>" slider-max-value="<?php echo esc_attr( $this->input_attrs['max'] ); ?>" slider-step-value="<?php echo esc_attr( $this->input_attrs['step'] ); ?>"></div><span class="slider-reset dashicons dashicons-image-rotate" slider-reset-value="<?php echo esc_attr( $this->value() ); ?>"></span>
</div>
<?php
}
}
class Amberd_Image_Radio_Button_Custom_Control extends WP_Customize_Control {
public $type = 'amberd_image_radio_button';
public function render_content() {
?>
<div class="image_radio_button_control">
<?php if( !empty( $this->label ) ) { ?>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php } ?>
<?php if( !empty( $this->description ) ) { ?>
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
<?php } ?>
<?php foreach ( $this->choices as $key => $value ) { ?>
<label class="radio-button-label">
<input type="radio" name="<?php echo esc_attr( $this->id ); ?>" value="<?php echo esc_attr( $key ); ?>" <?php $this->link(); ?> <?php checked( esc_attr( $key ), $this->value() ); ?>/>
<img src="<?php echo esc_attr( $value['image'] ); ?>" alt="<?php echo esc_attr( $value['name'] ); ?>" title="<?php echo esc_attr( $value['name'] ); ?>" />
</label>
<?php } ?>
</div>
<?php
}
}
}