BraadMartin / components

A collection of custom WordPress theme and plugin components
103 stars 36 forks source link

Implementation with wordpress 4.5.2 #9

Open Ardmark opened 8 years ago

Ardmark commented 8 years ago

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.

palamike commented 7 years ago

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