1

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

4

1 回答 1

0

这两个文件为颜色选择器设置了“选择颜色”

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

它们是核心文件,您所做的任何更改都将被未来的更新覆盖。您应该能够为添加元框的初始化操作编写过滤器

于 2013-09-23T22:39:59.193 回答