Skip to content

Commit 678eeb7

Browse files
committed
Merge pull request #18 from bearded-avenger/master
fix color picker
2 parents fd6cf14 + a1293f1 commit 678eeb7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

class.settings-api.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function __construct() {
4040
*/
4141
function admin_enqueue_scripts() {
4242
wp_enqueue_style( 'wp-color-picker' );
43+
wp_enqueue_script('wp-color-picker');
4344
wp_enqueue_script( 'jquery' );
4445
wp_enqueue_script( 'media-upload' );
4546
wp_enqueue_script( 'thickbox' );
@@ -340,7 +341,7 @@ function callback_color( $args ) {
340341
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
341342
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
342343

343-
$html = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
344+
$html = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] );
344345
$html .= sprintf( '<span class="description" style="display:block;"> %s</span>', $args['desc'] );
345346

346347
echo $html;

0 commit comments

Comments
 (0)