-
Notifications
You must be signed in to change notification settings - Fork 7
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
WP 5.5 Incompatibility issue #7
base: master
Are you sure you want to change the base?
Conversation
Hi @moritzlang, Thank you for your contribution. You are right, we need to update the kallookoo/wp-color-picker-alpha dependency to 3.0.0. But it would be great to update also the way to load the script as that is recommended: https://github.com/kallookoo/wp-color-picker-alpha#usage. |
Hi @7studio! |
global $wp_scripts; | ||
|
||
$url = $this->settings['url']; | ||
$version = $this->settings['version']; | ||
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | ||
|
||
// register if not already (on front end) | ||
// http://wordpress.stackexchange.com/questions/82718/how-do-i-implement-the-wordpress-iris-picker-into-my-plugin-on-the-front-end | ||
if ( ! isset( $wp_scripts->registered['iris'] ) ) { | ||
wp_register_style( 'wp-color-picker', admin_url( 'css/color-picker.css' ), array(), '', true ); | ||
|
||
wp_register_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.0.7', true ); | ||
wp_register_script( 'wp-color-picker', admin_url( 'js/color-picker.min.js' ), array( 'iris' ), '', true ); | ||
|
||
wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', array( | ||
'clear' => __( 'Clear', 'swp-acf-cp' ), | ||
'defaultString' => __( 'Default', 'swp-acf-cp' ), | ||
'pick' => __( 'Select Color', 'swp-acf-cp' ), | ||
'current' => __( 'Current Color', 'swp-acf-cp' ) | ||
) ); | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you restore this part please? That is no relation with the new way to load wp-color-picker-alpha ;)
@@ -176,7 +176,7 @@ function render_field( $field ) { | |||
?> | |||
<div class="acf-color-palette"> | |||
<?php acf_hidden_input( $hidden_input ); ?> | |||
<input type="text" <?php echo acf_esc_attr( $text_input ); ?> data-alpha="true"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the right way to operate because acf_esc_attr
will output a class
attribute too. That will be better to modify the variable $text_input
like that: $text_input['class'] .= ' color-picker';
.
Since the Wordpress 5.5 Update there is a known incompatibility issue of the wp-color-picker-alpha vendor.
Updating the dependency resolves issues with styles and translations.