Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

What is the path to the 3.5 colorpicker stylesheet?

wp_enqueue_style( 'wp-color-picker' );

I am trying to enqueue the color picker from a child theme but it does not load.

I have added an admin metabox that shows when editing pages and posts and one of the options in the metabox is a color choice. I have the colorpicker script loading but the button does not bring up the picker because I am not loading the stylesheet.

When I firebug the colorpicker and switch from display: none it shows.

It looks like this is the stylesheet that loads: load-style.php. However, I took the css from this file and pasted it into my child theme style but the color picker does not work.

UPDATE: It looks like the style is loading but nothing happens when the click on the color picker. The default color loads in the picker, etc.

I think the javascript is not working. When you click on the picker the 'wp-picker-open' class is not added to the <input> tag.

jQuery(document).ready(function($){
   $('.color-picker').wpColorPicker();
});


function wp_enqueue_color_picker() {
    wp_enqueue_style( 'wp-color-picker' );
    wp_enqueue_script( 'wp-color-picker-script', get_bloginfo('stylesheet_directory').'/include/javascript/custom-scripts.js', array( 'wp-color-picker' ), false, true );
}
add_action( 'admin_enqueue_scripts', 'wp_enqueue_color_picker' );


<input type="text" value="#cc9999" class="color-picker" data-default-color="#009999" />
share|improve this question
    
Where precisely are you making enqueue call? That should work. –  Rarst Jun 12 '13 at 19:57
    
in the child themes function.php file. –  Jason Jun 12 '13 at 20:37
    
I think the javascript is not working. When you click on the picker the 'wp-picker-open' class is not added to the <inout> tag. –  Jason Jun 12 '13 at 20:45
    
Try removing all other JavaScript (except jQuery) from the page to rule out a JavaScript conflict. –  Charles Clarkson Jul 30 '13 at 5:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.