Question

this is the code I m using:

    function SDS_admin_init() {         
       wp_register_script( 'SDS-color-picker', plugins_url('/js/SDS-color-picker.js', __FILE__), array( 'wp-color-picker' ), false, true);
    }
add_action( 'admin_init', 'SDS_admin_init' );


function SDS_admin_enqueue_scripts() { 

  // check if this your page here with the upload form!
  if(get_post_type() !== 'post')
    return;

        wp_enqueue_script( 'SDS-color-picker' );                        
        wp_enqueue_style( 'wp-color-picker' );      

}
add_action( 'admin_enqueue_scripts', 'SDS_admin_enqueue_scripts' );

This is my SDS-color-picker script:

jQuery(document).ready(function($) {

var myOptions = {

    defaultColor: false,        
    change: function(event, ui){},        
    clear: function() {},       
    hide: true,
    palettes: true
};

$('.my-color-field').wpColorPicker(myOptions);

}); //onready

The '.my-color-field' input field is in a metabox of my plugin. I want to know how can I change the text 'select color' on the button of the color picker...maybe with the wp_localize_script function to pass some default parameters to the color picker script ???

I realy need help on this one! thanks

Was it helpful?

Solution

These two files set "Select Color" for the color picker

wp-includes\js\colorpicker.js
wp-includes\script-loader.php

They are core files and any changes you make will be overwritten by future updates. You should be able to write a filter for the initialization action that adds the meta box

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top