updated theme GeneratePress
version 3.5.1
This commit is contained in:
@ -53,7 +53,7 @@ class GeneratePress_Customize_Field {
|
||||
$control_args['type'] = 'generate-wrapper-control';
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Customize_React_Control(
|
||||
new GeneratePress_Customize_Wrapper_Control(
|
||||
$wp_customize,
|
||||
$id,
|
||||
$control_args
|
||||
|
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* Customize API: Wrapper class.
|
||||
*
|
||||
* @package GeneratePress
|
||||
*/
|
||||
|
||||
/**
|
||||
* Customize Wrapper Control class.
|
||||
*
|
||||
* @see WP_Customize_Control
|
||||
*/
|
||||
class GeneratePress_Customize_Wrapper_Control extends WP_Customize_Control {
|
||||
/**
|
||||
* Type.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'generate-wrapper-control';
|
||||
|
||||
/**
|
||||
* Refresh the parameters passed to the JavaScript via JSON.
|
||||
*
|
||||
* @since 3.4.0
|
||||
* @uses WP_Customize_Control::to_json()
|
||||
*/
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
$this->json['choices'] = $this->choices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty JS template.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function content_template() {}
|
||||
|
||||
/**
|
||||
* Empty PHP template.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_content() {
|
||||
$html_attributes = array(
|
||||
'class' => 'generate-customize-control-wrapper',
|
||||
'id' => $this->id,
|
||||
'data-wrapper-type' => $this->choices['type'],
|
||||
);
|
||||
|
||||
if ( ! empty( $this->choices['class'] ) ) {
|
||||
$html_attributes['class'] .= ' ' . $this->choices['class'];
|
||||
}
|
||||
|
||||
$attributes_string = '';
|
||||
|
||||
foreach ( $html_attributes as $attribute => $value ) {
|
||||
$attributes_string .= $attribute . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
|
||||
$this->toggleIdScript();
|
||||
?>
|
||||
<div <?php echo $attributes_string; // phpcs:ignore -- Escaped above. ?>>
|
||||
<?php
|
||||
foreach ( $this->choices['items'] as $wrapper ) {
|
||||
?>
|
||||
<div id="<?php echo esc_attr( $wrapper . '--wrapper' ); ?>"></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a script to toggle the wrapper.
|
||||
*/
|
||||
public function toggleIdScript() {
|
||||
if ( ! empty( $this->choices['toggleId'] ) ) :
|
||||
?>
|
||||
<script>
|
||||
var liElement = document.getElementById( 'customize-control-<?php echo esc_js( $this->id ); ?>' );
|
||||
|
||||
if ( liElement ) {
|
||||
liElement.setAttribute('data-toggleId', '<?php echo esc_attr( $this->choices['toggleId'] ); ?>');
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-react-cont
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-color-control.php';
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-range-control.php';
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-typography-control.php';
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-wrapper-control.php';
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-upsell-section.php';
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-upsell-control.php';
|
||||
require_once trailingslashit( dirname( __FILE__ ) ) . 'controls/class-deprecated.php';
|
||||
|
@ -38,6 +38,11 @@ GeneratePress_Customize_Field::add_wrapper(
|
||||
$buttons_selector = 'button, html input[type="button"], input[type="reset"], input[type="submit"], a.button, a.button:visited, a.wp-block-button__link:not(.has-background)';
|
||||
$buttons_hover_selector = 'button:hover, html input[type="button"]:hover, input[type="reset"]:hover, input[type="submit"]:hover, a.button:hover, button:focus, html input[type="button"]:focus, input[type="reset"]:focus, input[type="submit"]:focus, a.button:focus, a.wp-block-button__link:not(.has-background):active, a.wp-block-button__link:not(.has-background):focus, a.wp-block-button__link:not(.has-background):hover';
|
||||
|
||||
if ( defined( 'GP_PREMIUM_VERSION' ) && version_compare( GP_PREMIUM_VERSION, '2.4.1', '>' ) ) {
|
||||
$buttons_selector .= ', .wc-block-components-button';
|
||||
$buttons_hover_selector .= ', .wc-block-components-button:hover';
|
||||
}
|
||||
|
||||
GeneratePress_Customize_Field::add_field(
|
||||
'generate_settings[form_button_background_color]',
|
||||
'GeneratePress_Customize_Color_Control',
|
||||
|
@ -370,6 +370,12 @@ function generate_do_control_inline_scripts() {
|
||||
'palette' => $colors,
|
||||
'showGoogleFonts' => apply_filters( 'generate_font_manager_show_google_fonts', true ),
|
||||
'colorPickerShouldShift' => function_exists( 'did_filter' ),
|
||||
'gpFontLibrary' => class_exists( 'GeneratePress_Pro_Font_Library' )
|
||||
? GeneratePress_Pro_Font_Library::get_fonts()
|
||||
: array(),
|
||||
'gpFontLibraryURI' => class_exists( 'GeneratePress_Pro_Font_Library' )
|
||||
? GeneratePress_Pro_Font_Library::get_font_library_uri()
|
||||
: '',
|
||||
)
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user