first commit
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Pro customizer section.
|
||||
* highly based on
|
||||
* https://github.com/justintadlock/trt-customizer-pro/blob/master/example-1/section-pro.php
|
||||
*/
|
||||
class HU_Customize_Section_Pro extends WP_Customize_Section {
|
||||
|
||||
/**
|
||||
* The type of customize section being rendered.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type ='czr-customize-section-pro';
|
||||
|
||||
/**
|
||||
* Custom button text to output.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
||||
public $pro_text = '';
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $pro_url = '';
|
||||
|
||||
|
||||
/**
|
||||
* Add custom parameters to pass to the JS via JSON.
|
||||
*
|
||||
* @return void
|
||||
* @override
|
||||
*/
|
||||
public function json() {
|
||||
$json = parent::json();
|
||||
$json['pro_text'] = $this->pro_text;
|
||||
$json['pro_url'] = $this->pro_url;
|
||||
return $json;
|
||||
}
|
||||
|
||||
//overrides the default template
|
||||
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 }}" title="{{ data.title }}" class="button button-secondary alignright" target="_blank">{{ data.pro_text }}</a>
|
||||
<# } #>
|
||||
</h3>
|
||||
</li>
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Base customizer section.
|
||||
*/
|
||||
class HU_Customize_Sections extends WP_Customize_Section {
|
||||
|
||||
/**
|
||||
* The type of customize section being rendered.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'czr-customize-sections';
|
||||
|
||||
public $ubq_panel;
|
||||
|
||||
|
||||
/**
|
||||
* Add custom parameters to pass to the JS via JSON.
|
||||
*
|
||||
* @return void
|
||||
* @override
|
||||
*/
|
||||
public function json() {
|
||||
$json = parent::json();
|
||||
if ( is_array( $this->ubq_panel ) && array_key_exists( 'panel', $this->ubq_panel ) ) {
|
||||
$json['ubq_panel'] = $this->ubq_panel;
|
||||
}
|
||||
return $json;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/***************************************************
|
||||
* AUGMENTS WP CUSTOMIZE SECTIONS
|
||||
***************************************************/
|
||||
if ( ! class_exists( 'HU_Customize_Manage_Widgets_Section' ) ) :
|
||||
class HU_Customize_Manage_Widgets_Section extends WP_Customize_Section {
|
||||
|
||||
/**
|
||||
* type of this section.
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'widget_zones_management';
|
||||
|
||||
|
||||
public function __construct( $manager, $id, $args = array() ) {
|
||||
//let the parent say what he needs to. We need to hear that sometimes.
|
||||
parent::__construct($manager, $id, $args );
|
||||
//add_action( 'customize_controls_print_footer_scripts', array( $this, 'hu_render_widget_zone_template' ), 1 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render the section, and the controls that have been added to it.
|
||||
* hook : customize_controls_print_footer_scripts
|
||||
*/
|
||||
public function hu_render_widget_zone_template() {
|
||||
?>
|
||||
<script type="text/html" id="tmpl-customize-section-<?php echo $this->type; ?>">
|
||||
<li id="accordion-section-{{ data.id }}" class="czr-widget-zone-section accordion-section control-section control-section-{{ data.type }}">
|
||||
<h3 class="accordion-section-title" tabindex="0">
|
||||
{{ data.title }}
|
||||
<span class="screen-reader-text"><?php _e( 'Press return or enter to open this section', 'hueman' ); ?></span>
|
||||
</h3>
|
||||
<ul class="accordion-section-content"></ul>
|
||||
</li>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}//class
|
||||
|
||||
endif;
|
||||
Reference in New Issue
Block a user