[wp-trac] [WordPress Trac] #36512: Color picker has disappeared from input in custom post type.

WordPress Trac noreply at wordpress.org
Wed Apr 13 14:55:39 UTC 2016


#36512: Color picker has disappeared from input in custom post type.
----------------------------+-----------------------------
 Reporter:  anou            |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  General         |    Version:  4.5
 Severity:  normal          |   Keywords:
  Focuses:  ui, javascript  |
----------------------------+-----------------------------
 In a custom plugin I've created some metaboxes with color picker fields.
 Here how I call the color picker style :

 {{{
 add_action( 'admin_enqueue_scripts', 'le_chiffre_add_color_picker' );
 function le_chiffre_add_color_picker( $hook ) {
   // $hook to apply a check for admin page.
   wp_enqueue_style( 'wp-color-picker' );

   wp_enqueue_script( 'custom-script-handle', plugins_url( 'custom-
 script.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
 }
 }}}

 the HTML input (created dynamically):

 {{{
 <input class="color-field" placeholder="#FFCC00" id="_chiffre_bgcolor"
 name="_chiffre_bgcolor" value="#c61d4c" size="" type="text">
 }}}

 and the js for my input fields, loading the color picker:

 {{{
 (function( $ ) {

     // Add Color Picker to all inputs that have 'color-field' class
     $(function() {
         $('.color-field').each(function(){
           $(this).wpColorPicker();
         });
     });

 })( jQuery );
 }}}

 With WordPress 4.4.2 everything worked like a charm (I even did a reverse
 from 4.5 to 4.4.2 to be sure of it) and now with the 4.5 version, the
 color picker doesn't show up on my fields...

 I didn't found anybody having the same issue.

 Have a nice day
 David THOMAS

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36512>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list