consultstreet
This commit is contained in:
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* Customize Base control class.
|
||||
*
|
||||
* @package consultstreet
|
||||
*
|
||||
* @see WP_Customize_Control
|
||||
* @access public
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class ConsultStreet_Customize_Base_Control
|
||||
*/
|
||||
class ConsultStreet_Customize_Base_Control extends WP_Customize_Control {
|
||||
|
||||
/**
|
||||
* Enqueue scripts all controls.
|
||||
*/
|
||||
public function enqueue() {
|
||||
|
||||
// Color picker alpha.
|
||||
wp_enqueue_script( 'wp-color-picker-alpha', CONSULTSTREET_PARENT_INC_URI . '/customizer/controls/js/wp-color-picker-alpha.js', array( 'wp-color-picker' ), '2.1.3', true );
|
||||
|
||||
$color_picker_strings = array(
|
||||
'clear' => __( 'Clear', 'consultstreet' ),
|
||||
'clearAriaLabel' => __( 'Clear color', 'consultstreet' ),
|
||||
'defaultString' => __( 'Default', 'consultstreet' ),
|
||||
'defaultAriaLabel' => __( 'Select default color', 'consultstreet' ),
|
||||
'pick' => __( 'Select Color', 'consultstreet' ),
|
||||
'defaultLabel' => __( 'Color value', 'consultstreet' ),
|
||||
);
|
||||
wp_localize_script( 'wp-color-picker-alpha', 'wpColorPickerL10n', $color_picker_strings );
|
||||
wp_enqueue_script( 'wp-color-picker-alpha' );
|
||||
|
||||
// Scripts for nesting panel/section.
|
||||
wp_enqueue_script( 'consultstreet-extend-customizer', CONSULTSTREET_PARENT_INC_URI . '/customizer/assets/js/extend-customizer.js', array( 'jquery' ), false, true );
|
||||
wp_enqueue_style( 'consultstreet-extend-customizer', CONSULTSTREET_PARENT_INC_URI . '/customizer/assets/css/extend-customizer.css' );
|
||||
|
||||
// Main scripts.
|
||||
wp_enqueue_script(
|
||||
'consultstreet-controls',
|
||||
CONSULTSTREET_PARENT_INC_URI . '/customizer/controls/js/controls.js',
|
||||
array(
|
||||
'jquery',
|
||||
'customize-base',
|
||||
'wp-color-picker-alpha',
|
||||
),
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
wp_enqueue_style( 'consultstreet-controls', CONSULTSTREET_PARENT_INC_URI . '/customizer/controls/css/controls.css' );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refresh the parameters passed to the JavaScript via JSON.
|
||||
*
|
||||
* @see WP_Customize_Control::to_json()
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function to_json() {
|
||||
|
||||
parent::to_json();
|
||||
|
||||
$this->json['default'] = $this->setting->default;
|
||||
if ( isset( $this->default ) ) {
|
||||
$this->json['default'] = $this->default;
|
||||
}
|
||||
|
||||
$this->json['id'] = $this->id;
|
||||
$this->json['value'] = $this->value();
|
||||
$this->json['choices'] = $this->choices;
|
||||
$this->json['link'] = $this->get_link();
|
||||
$this->json['l10n'] = $this->l10n();
|
||||
|
||||
$this->json['inputAttrs'] = '';
|
||||
foreach ( $this->input_attrs as $attr => $value ) {
|
||||
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content is still called, so be sure to override it with an empty function in your subclass as well.
|
||||
*/
|
||||
protected function render_content() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the Underscore template for this control.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of translation strings.
|
||||
*
|
||||
* @access protected
|
||||
* @return array
|
||||
*/
|
||||
protected function l10n() {
|
||||
return array();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Customize Editor control class.
|
||||
*
|
||||
* @package consultstreet
|
||||
*
|
||||
* @see WP_Customize_Control
|
||||
* @access public
|
||||
*/
|
||||
if ( ! class_exists( 'WP_Customize_Control' ) )
|
||||
return NULL;
|
||||
/**
|
||||
* Class ConsultStreet_Customize_Category_Control
|
||||
*/
|
||||
class ConsultStreet_Customize_Category_Control extends WP_Customize_Control
|
||||
{
|
||||
private $cats = false;
|
||||
|
||||
public function __construct($manager, $id, $args = array(), $options = array())
|
||||
{
|
||||
$this->cats = get_categories($options);
|
||||
|
||||
parent::__construct( $manager, $id, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the content of the category dropdown
|
||||
*
|
||||
* @return HTML
|
||||
*/
|
||||
public function render_content()
|
||||
{
|
||||
if(!empty($this->cats))
|
||||
{
|
||||
?>
|
||||
<label>
|
||||
<span class="customize-category-select-control"><?php echo esc_html( $this->label ); ?></span>
|
||||
<select multiple <?php $this->link(); ?>>
|
||||
<?php
|
||||
foreach ( $this->cats as $cat )
|
||||
{
|
||||
printf('<option value="%s" %s>%s</option>', esc_html( $cat->term_id ), selected($this->value(), $cat->term_id, false), esc_html( $cat->name ));
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* Customize Color control class.
|
||||
*
|
||||
* @package consultstreet
|
||||
*
|
||||
* @see WP_Customize_Control
|
||||
* @access public
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class ConsultStreet_Customize_Color_Control
|
||||
*/
|
||||
class ConsultStreet_Customize_Color_Control extends ConsultStreet_Customize_Base_Control {
|
||||
|
||||
/**
|
||||
* Backwards compatibility.
|
||||
*
|
||||
* @access protected
|
||||
* @var bool
|
||||
*/
|
||||
protected $alpha = false;
|
||||
|
||||
/**
|
||||
* Customize control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'consultstreet-color';
|
||||
|
||||
/**
|
||||
* Colorpicker palette
|
||||
*
|
||||
* @access public
|
||||
* @var bool
|
||||
*/
|
||||
public $palette = true;
|
||||
|
||||
/**
|
||||
* Mode.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mode = 'full';
|
||||
|
||||
/**
|
||||
* Some fields require options to be set.
|
||||
* We're whitelisting the property here
|
||||
* and suggest you validate this in a child class.
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
public $choices = array();
|
||||
|
||||
/**
|
||||
* Refresh the parameters passed to the JavaScript via JSON.
|
||||
*
|
||||
* @see WP_Customize_Control::to_json()
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function to_json() {
|
||||
|
||||
parent::to_json();
|
||||
|
||||
$this->json['palette'] = $this->palette;
|
||||
$this->json['choices']['alpha'] = ( isset( $this->choices['alpha'] ) && $this->choices['alpha'] ) ? 'true' : 'false';
|
||||
$this->json['mode'] = $this->mode;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content is still called, so be sure to override it with an empty function in your subclass as well.
|
||||
*/
|
||||
protected function render_content() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Customize Heading control class.
|
||||
*
|
||||
* @package consultstreet
|
||||
*
|
||||
* @see WP_Customize_Control
|
||||
* @access public
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class ConsultStreet_Customize_Heading_Control
|
||||
*/
|
||||
class ConsultStreet_Customize_Heading_Control extends ConsultStreet_Customize_Base_Control {
|
||||
|
||||
/**
|
||||
* Customize control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'consultstreet-heading';
|
||||
|
||||
/**
|
||||
* Renders the Underscore template for this control.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {
|
||||
?>
|
||||
|
||||
<h4>
|
||||
<# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #>
|
||||
</h4>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content is still called, so be sure to override it with an empty function in your subclass as well.
|
||||
*/
|
||||
protected function render_content() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*
|
||||
* Upgrade to pro options
|
||||
*/
|
||||
|
||||
function consultstreet_upgrade_pro_options( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_section(
|
||||
'upgrade_premium',
|
||||
array(
|
||||
'title' => __('Upgrade to Pro','consultstreet'),
|
||||
'priority' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
class ConsultStreet_WP_Button_Customize_Control extends WP_Customize_Control {
|
||||
public $type = 'upgrade_premium';
|
||||
|
||||
function render_content() {
|
||||
?>
|
||||
<div class="pro_info">
|
||||
<ul>
|
||||
<li><a class="documentation" href="https://helpdoc.themearile.com/" target="_blank"><i class="dashicons dashicons-visibility"></i><?php _e( 'View Documentation','consultstreet' ); ?> </a></li>
|
||||
|
||||
<li><a class="support" href="https://themearile.com/forums/" target="_blank"><i class="dashicons dashicons-lightbulb"></i><?php _e( 'Get Full Support','consultstreet' ); ?> </a></li>
|
||||
|
||||
<li><a class="free-pro" href="https://themearile.com/consultstreet-pro-theme/#free-pro-features" target="_blank"><i class="dashicons dashicons-visibility"></i><?php _e( 'Free Vs Pro Features','consultstreet' ); ?> </a></li>
|
||||
|
||||
<li><a class="upgrade-to-pro" href="https://themearile.com/consultstreet-pro-theme/" target="_blank"><i class="dashicons dashicons-update-alt"></i><?php _e( 'Upgrade to Pro','consultstreet' ); ?> </a></li>
|
||||
|
||||
<li><a class="show-love" href="https://wordpress.org/support/theme/consultstreet/reviews/#new-post" target="_blank"><i class="dashicons dashicons-smiley"></i><?php _e( 'Share a Good Review','consultstreet' ); ?> </a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'pro_info_buttons',
|
||||
array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'consultstreet_sanitize_text',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control( new ConsultStreet_WP_Button_Customize_Control( $wp_customize, 'pro_info_buttons', array(
|
||||
'section' => 'upgrade_premium',
|
||||
))
|
||||
);
|
||||
}
|
||||
add_action( 'customize_register', 'consultstreet_upgrade_pro_options' );
|
||||
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Customize Radio Buttonset control class.
|
||||
*
|
||||
* @package consultstreet
|
||||
*
|
||||
* @see WP_Customize_Control
|
||||
* @access public
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class ConsultStreet_Customize_Radio_Buttonset_Control
|
||||
*/
|
||||
class ConsultStreet_Customize_Radio_Buttonset_Control extends ConsultStreet_Customize_Base_Control {
|
||||
|
||||
/**
|
||||
* Customize control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'consultstreet-radio-buttonset';
|
||||
|
||||
/**
|
||||
* Renders the Underscore template for this control.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {
|
||||
?>
|
||||
|
||||
<# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #>
|
||||
<# if ( data.description ) { #>
|
||||
<span class="description customize-control-description">{{{ data.description }}}</span><# } #>
|
||||
<div id="input_{{ data.id }}" class="buttonset">
|
||||
<# for ( key in data.choices ) { #>
|
||||
<input {{{ data.inputAttrs }}} class="switch-input screen-reader-text" type="radio" value="{{ key }}"
|
||||
name="_customize-radio-{{{ data.id }}}" id="{{ data.id }}{{ key }}" {{{ data.link }}}<# if ( key === data.value ) { #> checked="checked" <# } #>>
|
||||
<label class="switch-label switch-label-<# if ( key === data.value ) { #>on <# } else { #>off<# } #>"
|
||||
for="{{ data.id }}{{ key }}">{{ data.choices[ key ] }}</label>
|
||||
</input>
|
||||
<# } #>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content is still called, so be sure to override it with an empty function in your subclass as well.
|
||||
*/
|
||||
protected function render_content() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* Customize Radio Image control class.
|
||||
*
|
||||
* @package consultstreet
|
||||
*
|
||||
* @see WP_Customize_Control
|
||||
* @access public
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class ConsultStreet_Customize_Radio_Image_Control
|
||||
*/
|
||||
class ConsultStreet_Customize_Radio_Image_Control extends ConsultStreet_Customize_Base_Control {
|
||||
|
||||
/**
|
||||
* Customize control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'consultstreet-radio-image';
|
||||
|
||||
/**
|
||||
* Refresh the parameters passed to the JavaScript via JSON.
|
||||
*
|
||||
* @see WP_Customize_Control::to_json()
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function to_json() {
|
||||
|
||||
parent::to_json();
|
||||
|
||||
foreach ( $this->input_attrs as $attr => $value ) {
|
||||
if ( 'style' !== $attr ) {
|
||||
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
||||
continue;
|
||||
}
|
||||
$this->json['labelStyle'] = 'style="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the Underscore template for this control.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {
|
||||
?>
|
||||
|
||||
<label class="customizer-text">
|
||||
<# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #>
|
||||
<# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><#
|
||||
} #>
|
||||
</label>
|
||||
<div id="input_{{ data.id }}" class="image">
|
||||
<# for ( key in data.choices ) { #>
|
||||
<# dataAlt = ( _.isObject( data.choices[ key ] ) && ! _.isUndefined( data.choices[ key ].alt ) ) ?
|
||||
data.choices[ key ].alt : '' #>
|
||||
<input {{{ data.inputAttrs }}} class="image-select" type="radio" value="{{ key }}"
|
||||
name="_customize-radio-{{ data.id }}" id="{{ data.id }}{{ key }}" {{{ data.link }}}<# if ( data.value === key ) { #> checked="checked"<# } #> data-alt="{{ dataAlt }}">
|
||||
<label for="{{ data.id }}{{ key }}" {{{ data.labelStyle }}} class="{{{ data.id + key }}}">
|
||||
<# if ( _.isObject( data.choices[ key ] ) ) { #>
|
||||
<img src="{{ data.choices[ key ].src }}" alt="{{ data.choices[ key ].alt }}">
|
||||
<span class="image-label"><span class="inner">{{ data.choices[ key ].alt }}</span></span>
|
||||
<# } else { #>
|
||||
<img src="{{ data.choices[ key ] }}">
|
||||
<# } #>
|
||||
<span class="image-clickable"></span>
|
||||
</label>
|
||||
</input>
|
||||
<# } #>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content is still called, so be sure to override it with an empty function in your subclass as well.
|
||||
*/
|
||||
protected function render_content() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* Customize Slider control class.
|
||||
*
|
||||
* @package consultstreet
|
||||
*
|
||||
* @see WP_Customize_Control
|
||||
* @access public
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class ConsultStreet_Customize_Slider_Control
|
||||
*/
|
||||
class ConsultStreet_Customize_Slider_Control extends ConsultStreet_Customize_Base_Control {
|
||||
|
||||
/**
|
||||
* Customize control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'consultstreet-slider';
|
||||
|
||||
/**
|
||||
* Refresh the parameters passed to the JavaScript via JSON.
|
||||
*
|
||||
* @see WP_Customize_Control::to_json()
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function to_json() {
|
||||
|
||||
parent::to_json();
|
||||
|
||||
if ( is_array( $this->json['default'] ) ) {
|
||||
foreach ( $this->json['default'] as $key => $value ) {
|
||||
$this->json['choices']['controls'][ $key ] = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the Underscore template for this control.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {
|
||||
?>
|
||||
|
||||
<# if ( data.label ) { #>
|
||||
<span class="customize-control-title">{{ data.label }}</span>
|
||||
<# } #>
|
||||
|
||||
<# if ( data.description ) { #>
|
||||
<span class="description customize-control-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
|
||||
<div class="customize-control-content">
|
||||
<div class="consultstreet-slider">
|
||||
<div id="custom-handle" class="ui-slider-handle"></div>
|
||||
</div>
|
||||
<div class="consultstreet-slider-input">
|
||||
<input {{{ data.inputAttrs }}} type="number" class="slider-input" value="{{ data.value['slider'] }}"/>
|
||||
<input type="text" value="{{ data.default['suffix'] }}" hidden>
|
||||
<span class="suffix">{{ data.default['suffix'] }}</span>
|
||||
<span class="slider-reset dashicons dashicons-image-rotate"><span
|
||||
class="screen-reader-text"><?php esc_html_e( 'Reset', 'consultstreet' ); ?></span></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content is still called, so be sure to override it with an empty function in your subclass as well.
|
||||
*/
|
||||
protected function render_content() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* Customize Sortable control class.
|
||||
*
|
||||
* @package consultstreet
|
||||
*
|
||||
* @see WP_Customize_Control
|
||||
* @access public
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class ConsultStreet_Customize_Sortable_Control
|
||||
*/
|
||||
class ConsultStreet_Customize_Sortable_Control extends ConsultStreet_Customize_Base_Control {
|
||||
|
||||
/**
|
||||
* Customize control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'consultstreet-sortable';
|
||||
|
||||
/**
|
||||
* Renders the Underscore template for this control.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {
|
||||
?>
|
||||
|
||||
<label class='consultstreet-sortable'>
|
||||
<span class="customize-control-title">
|
||||
{{{ data.label }}}
|
||||
</span>
|
||||
<# if ( data.description ) { #>
|
||||
<span class="description customize-control-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
|
||||
<ul class="sortable">
|
||||
<# _.each( data.value, function( choiceID ) { #>
|
||||
<li {{{ data.inputAttrs }}} class='consultstreet-sortable-item' data-value='{{ choiceID }}'>
|
||||
<i class='dashicons dashicons-menu'></i>
|
||||
<i class="dashicons dashicons-visibility visibility"></i>
|
||||
{{{ data.choices[ choiceID ] }}}
|
||||
</li>
|
||||
<# }); #>
|
||||
<# _.each( data.choices, function( choiceLabel, choiceID ) { #>
|
||||
<# if ( -1 === data.value.indexOf( choiceID ) ) { #>
|
||||
<li {{{ data.inputAttrs }}} class='consultstreet-sortable-item invisible' data-value='{{ choiceID }}'>
|
||||
<i class='dashicons dashicons-menu'></i>
|
||||
<i class="dashicons dashicons-visibility visibility"></i>
|
||||
{{{ data.choices[ choiceID ] }}}
|
||||
</li>
|
||||
<# } #>
|
||||
<# }); #>
|
||||
</ul>
|
||||
</label>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content is still called, so be sure to override it with an empty function in your subclass as well.
|
||||
*/
|
||||
protected function render_content() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Customize Toggle control class.
|
||||
*
|
||||
* @package consultstreet
|
||||
*
|
||||
* @see WP_Customize_Control
|
||||
* @access public
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class ConsultStreet_Customize_Toggle_Control
|
||||
*/
|
||||
class ConsultStreet_Customize_Toggle_Control extends ConsultStreet_Customize_Base_Control {
|
||||
|
||||
/**
|
||||
* Customize control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'consultstreet-toggle';
|
||||
|
||||
/**
|
||||
* Renders the Underscore template for this control.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {
|
||||
?>
|
||||
|
||||
<label for="toggle_{{ data.id }}">
|
||||
<span class="customize-control-title">
|
||||
{{{ data.label }}}
|
||||
</span>
|
||||
<# if ( data.description ) { #>
|
||||
<span class="description customize-control-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
<input class="screen-reader-text" {{{ data.inputAttrs }}} name="toggle_{{ data.id }}"
|
||||
id="toggle_{{ data.id }}" type="checkbox" value="{{ data.value }}" {{{ data.link }}}<# if ( true === data.value ) { #> checked<# } #> hidden />
|
||||
<span class="switch"></span>
|
||||
</label>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content is still called, so be sure to override it with an empty function in your subclass as well.
|
||||
*/
|
||||
protected function render_content() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! class_exists( 'WP_Customize_Control' ) )
|
||||
return NULL;
|
||||
/**
|
||||
* Typography control
|
||||
*/
|
||||
class ConsultStreet_Customizer_Typography_Control extends WP_Customize_Control {
|
||||
|
||||
/**
|
||||
* The control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'consultstreet-typography';
|
||||
|
||||
/**
|
||||
* Render the control's content.
|
||||
* Allows the content to be overriden without having to rewrite the wrapper in $this->render().
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function render_content() {
|
||||
$this_val = $this->value(); ?>
|
||||
<label>
|
||||
<?php if ( ! empty( $this->label ) ) : ?>
|
||||
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $this->description ) ) : ?>
|
||||
<span class="description customize-control-description"><?php echo wp_kses_post( $this->description ); ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<select class="consultstreet-typography-select" <?php $this->link(); ?>>
|
||||
<?php
|
||||
// Get Standard font options
|
||||
if ( $std_fonts = consultstreet_standard_fonts() ) { ?>
|
||||
<optgroup label="<?php esc_attr_e( 'Standard Fonts', 'consultstreet' ); ?>">
|
||||
<?php
|
||||
// Loop through font options and add to select
|
||||
foreach ( $std_fonts as $font ) { ?>
|
||||
<option value="<?php echo esc_html( $font ); ?>" <?php selected( $font, $this_val ); ?>><?php echo esc_html( $font ); ?></option>
|
||||
<?php } ?>
|
||||
</optgroup>
|
||||
<?php }
|
||||
|
||||
// Google font options
|
||||
if ( $google_fonts = consultstreet_google_fonts_array() ) { ?>
|
||||
<optgroup label="<?php esc_attr_e( 'Google Fonts', 'consultstreet' ); ?>">
|
||||
<?php
|
||||
// Loop through font options and add to select
|
||||
foreach ( $google_fonts as $font ) { ?>
|
||||
<option value="<?php echo esc_html( $font ); ?>" <?php selected( $font, $this_val ); ?>><?php echo esc_html( $font ); ?></option>
|
||||
<?php } ?>
|
||||
</optgroup>
|
||||
<?php } ?>
|
||||
</select>
|
||||
|
||||
</label>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Customize Heading control class.
|
||||
*
|
||||
* @package consultstreet
|
||||
*
|
||||
* @see WP_Customize_Control
|
||||
* @access public
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class ConsultStreet_Customize_Upgrade_Control
|
||||
*/
|
||||
class ConsultStreet_Customize_Upgrade_Control extends ConsultStreet_Customize_Base_Control {
|
||||
|
||||
/**
|
||||
* Customize control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'consultstreet-upgrade';
|
||||
|
||||
/**
|
||||
* Renders the Underscore template for this control.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {
|
||||
$upgrade_to_pro_link = 'https://themearile.com/consultstreet-pro-theme/';
|
||||
?>
|
||||
|
||||
<div class="consultstreet-upgrade-pro-message" style="display:none;";>
|
||||
<# if ( data.label ) { #><h4 class="customize-control-title"><?php echo wp_kses_post( 'Upgrade to <a href="'.$upgrade_to_pro_link.'" target="_blank" > ConsultStreet Pro </a> to be add more', 'consultstreet'); ?> {{{ data.label }}} <?php esc_html_e( 'and get the other pro features.', 'consultstreet') ?></h4><# } #>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content is still called, so be sure to override it with an empty function in your subclass as well.
|
||||
*/
|
||||
protected function render_content() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user