Adding jQuery datepicker to admin
-
I have a plugin page under the Tools menu and trying to add the datepicker to a couple of date fields. It is working, but the style is not, I get a plain popup calendar with no styling, transparent, so hard to see. Here is my code following the examples at the page below….
add_action( ‘admin_enqueue_scripts’, ‘enqueue_date_picker’ );
function enqueue_date_picker(){
wp_enqueue_script(
‘wmnf-jquery’,
get_stylesheet_directory_uri() . ‘/wmnf/wmnf_jquery.js’,
array(‘jquery’, ‘jquery-ui-core’, ‘jquery-ui-datepicker’),
time(),
true
);
wp_enqueue_style( ‘jquery-ui-datepicker’ );
}I followed the example here, is the wp_enqueue_style supposed to add the style? I’m hoping perhaps this part just needs to be different for my version of WordPress.
http://www.paulund.co.uk/default-scripts-to-add-in-wordpress-development
If I replace the wp_enqueue_style with the google api URL it works….
wp_enqueue_style(‘jquery-ui-css’, ‘http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css’);
But I’d rather use built in WP if possible, what am I doing wrong?
The topic ‘Adding jQuery datepicker to admin’ is closed to new replies.