bueltge / wordpress-admin-style

This plugin reference elements from wp-admin in an overview with the necessary markup and CSS classes to help you to develop WordPress compliant.
http://wpengineer.com/2226/new-plugin-to-style-your-plugin-on-wordpress-admin-with-default-styles/
GNU General Public License v2.0
960 stars 124 forks source link

Add Color Picker Example #40

Closed bueltge closed 3 years ago

bueltge commented 8 years ago
add_action( 'admin_enqueue_scripts', 'mw_enqueue_color_picker' );
function mw_enqueue_color_picker( $hook_suffix ) {
    // first check that $hook_suffix is appropriate for your admin page
    wp_enqueue_style( 'wp-color-picker' );
    wp_enqueue_script( 'my-script-handle', plugins_url('my-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
}
<input type="text" value="#bada55" class="my-color-field" data-default-color="#effeff" />
jQuery(document).ready(function($){
    $('.my-color-field').wpColorPicker();
});

Since WP 3.5 https://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/

bueltge commented 3 years ago

Include via c4bdf61fe9ee5b3eb207bedc6891dce53ae54350