BraadMartin / components

A collection of custom WordPress theme and plugin components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implementation with wordpress 4.5.2

Ardmark opened this issue · comments

The color picker works fine, but I get the following error:

ReferenceError: wpColorPickerL10n is not defined

The solution is to enqueue iris and wp-color-picker, then define wpColorPickerL10n as follows:
wp_enqueue_script( 'wp-color-picker', admin_url( 'js/color-picker.js' ), array('jquery-ui-widget','iris'), false, 1); $colorpicker_l10n = array( 'clear' => __( 'Clear' ), 'defaultString' => __( 'Default' ), 'pick' => __( 'Select Color' ), 'current' => __( 'Current Color' ), ); wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', $colorpicker_l10n ); wp_enqueue_script( 'alpha-color-picker', plugins_url( 'alpha-color-picker/alpha-color-picker.js', __FILE__ ), array( 'jquery', 'iris'), null, true );
And thanks for the great work on this color picker.

Just note that in version 4.7.4, The base code works fine without any modification. It should not be an issue now.