Skip to content

Implementation with wordpress 4.5.2 #9

@Ardmark

Description

@Ardmark

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions