name = 'color_picker'; $this->label = __("Color Picker",'acf'); $this->category = 'jquery'; $this->defaults = array( 'default_value' => '', ); } /* * input_admin_enqueue_scripts * * description * * @type function * @date 16/12/2015 * @since 5.3.2 * * @param $post_id (int) * @return $post_id (int) */ function input_admin_enqueue_scripts() { // Register scripts for non-admin. // Applies logic from wp_default_scripts() function defined in "wp-includes/script-loader.php". if( !is_admin() ) { $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; $scripts = wp_scripts(); $scripts->add( 'iris', '/wp-admin/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.0.7', 1 ); $scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 ); // Handle localisation across multiple WP versions. // WP 5.0+ if( method_exists($scripts, 'set_translations') ) { $scripts->set_translations( 'wp-color-picker' ); // WP 4.9 } else { $scripts->localize( 'wp-color-picker', 'wpColorPickerL10n', array( 'clear' => __( 'Clear' ), 'clearAriaLabel' => __( 'Clear color' ), 'defaultString' => __( 'Default' ), 'defaultAriaLabel' => __( 'Select default color' ), 'pick' => __( 'Select Color' ), 'defaultLabel' => __( 'Color value' ), )); } } // Enqueue. wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'wp-color-picker' ); } /* * render_field() * * Create the HTML interface for your field * * @param $field - an array holding all the field's data * * @type action * @since 3.6 * @date 23/01/13 */ function render_field( $field ) { // vars $text_input = acf_get_sub_array( $field, array('id', 'class', 'name', 'value') ); $hidden_input = acf_get_sub_array( $field, array('name', 'value') ); // html ?>