Heads up on COLOR PICKER/ALPHA CHANNEL javascript error (Due to WP 5.5)
- This topic has 3 replies, 3 voices, and was last updated 4 years, 5 months ago by
Paul Wenzel.
-
AuthorPosts
-
August 26, 2020 at 2:33 AM #21464
Teia Local Studio
ParticipantHey guys!
Just updated to WordPress 5.5 and I got a error on JavaScript console on the ALPHA CHANNEL feature for COLOR PICKER. At first moment I did think it was related to the META BOX suite, however it is a general problem happening on many themes and plugins out there.
So, I would suggest you to address a fix within Meta Box internals, because other people could think same way as me and come here asking for help.
I understand it is a problem inside the COLOR PICKER code, but, anyway, I did fix it using this on my theme functions.php file:
if( is_admin() ){ add_action( 'wp_default_scripts', 'wp_default_custom_scripts' ); function wp_default_custom_scripts( $scripts ){ $scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker.js", array( 'iris' ), false, 1 ); did_action( 'init' ) && $scripts->localize( 'wp-color-picker', 'wpColorPickerL10n', array( 'clear' => __( 'Clear' ), 'clearAriaLabel' => __( 'Clear color' ), 'defaultString' => __( 'Default' ), 'defaultAriaLabel' => __( 'Select default color' ), 'pick' => __( 'Select Color' ), 'defaultLabel' => __( 'Color value' ), ) ); } }
August 26, 2020 at 9:32 AM #21469Long Nguyen
ModeratorHi,
Meta Box uses WP Color Picker Alpha as a library as many themes/plugins. This issue has been noticed and the developer has created a pull request to fix it https://github.com/kallookoo/wp-color-picker-alpha/pull/38. We are waiting for this PR will be merged and update the new version of Meta Box.
Thanks for your code, it will help other users for temporary fixing.
September 23, 2020 at 11:30 AM #22053Long Nguyen
ModeratorSolved in the new version 5.3.4 of Meta Box, please update the plugin to fix this issue.
November 25, 2020 at 2:03 AM #23051Paul Wenzel
ParticipantI still see a broken alpha color picker in the Customizer when using Meta Box 5.3.4. The color picker works fine in the regular WordPress admin, but not in the Customizer.
I added this to my
functions.php
file to work around the issue:if( is_customize_preview() ) { add_action( 'wp_default_scripts', 'wp_default_custom_scripts' ); function wp_default_custom_scripts( $scripts ) { $scripts->add( 'wp-color-picker', '/wp-admin/js/color-picker.js', array( 'iris' ), false, 1 ); did_action( 'init' ) && $scripts->localize( 'wp-color-picker', 'wpColorPickerL10n', array( 'clear' => __( 'Clear' ), 'clearAriaLabel' => __( 'Clear color' ), 'defaultString' => __( 'Default' ), 'defaultAriaLabel' => __( 'Select default color' ), 'pick' => __( 'Select Color' ), 'defaultLabel' => __( 'Color value' ), ) ); } }
-
AuthorPosts
- You must be logged in to reply to this topic.