-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kirki is conflicting with the native customizer controls #918
Comments
Can you please send me a copy of that 3rd-party plugin so that I may replicate the issue? |
Reproduce:
<?php
/*
Plugin Name: Goodbye Dolly
Plugin URI: http://wordpress.org/plugins/hello-dolly/
Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.
Version: 1.0
*/
class HSPH_Theme_Customize {
public static function register ( $wp_customize ) {
// add the hsph footer options section
$wp_customize->add_section( 'hsph_footer_options',
array(
'title' => __( 'Site Footer', 'hsph' ),
'priority' => 150,
)
);
//1. Register new settings to the WP database...
$wp_customize->add_setting( 'hsph_twitter_footer_link',
array(
'default' => '', //Default setting/value to save
'type' => 'option',
'sanitize_callback' => 'esc_url_raw',
)
);
//2. Finally, we define the control itself (which links a setting to a section and renders the HTML controls)...
$wp_customize->add_control( 'hsph_twitter_footer_link_control',
array(
'label' => __( 'Twitter Link:', 'hsph' ),
'section' => 'hsph_footer_options',
'settings' => 'hsph_twitter_footer_link',
'type' => 'url',
)
);
//1. Register new settings to the WP database...
$wp_customize->add_setting( 'hsph_twitter_footer_tweets_count',
array(
'default' => 5, //Default setting/value to save
'type' => 'option',
'sanitize_callback' => 'absint',
)
);
//2. Finally, we define the control itself (which links a setting to a section and renders the HTML controls)...
$wp_customize->add_control( 'hsph_twitter_footer_tweets_count_control', //Set a unique ID for the control
array(
'label' => __( 'Number of Tweets to show:', 'hsph' ),
'section' => 'hsph_footer_options',
'settings' => 'hsph_twitter_footer_tweets_count',
'type' => 'number',
'input_attrs' => array(
'min' => 0,
'max' => 10
)
)
);
}// end function register
} // end class HSPH_Theme_Customize
// Setup the Theme Customizer settings and controls...
add_action( 'customize_register' , array( 'HSPH_Theme_Customize' , 'register' ) );
|
@aristath any clue? I'm pretty sure this was not an issue before 4.5. I haven't got time to reinstall a 4.4 and test. I'll try to test it later on today. |
@aristath I'm 99% sure that the issue is on the PHP side, commenting https://github.com/aristath/kirki/blob/develop/includes/class-kirki-init.php#L106 solve the problem for the number field. Changing |
yup, the main issue is that all kirki controls need prefixing. |
Yeah I think it safer to prefix everything internally. I'm still not entirely sure why it is a problem, the Customize Control should not really conflict with native controls... |
part of the issue is the global.scss as well as some pretty old code... cleaning that up now. |
almost all controls have been prefixed (with a couple exceptions 'cause it's just too late and I'm sleepy). |
So I tried the dev branch on my local dev. It fixes the number field issue. However the look it still a little weird, because as you mentioned global.sass is still styling the other fields but not this one. I think it is king of risky to style fields that are not added via Kirki. A 3rd party dev could be using its own styling and Kirki would be conflicting. Should all sections/panels/fields html elements use a standard "kirki" class that would be used as prefix for all styling? |
I think this should do the trick right? |
Issue description:
My Kirki controls are working well, the 3rd party plugin controls are partially working but all the html5 text inputs (number, urls) are broken.
Without Kirki activated:
With Kirki activated:
Values are not showing, the number field is now a text field...etc...
Version used:
2.3.1
Code to reproduce the issue (config + field(s))
Add a section , control and setting using Wordpress Core constrols with a "number" type.
Add a random section with Kirki
The text was updated successfully, but these errors were encountered: