Title: Back end loading?
Last modified: August 30, 2016

---

# Back end loading?

 *  Resolved [nikolagavric](https://wordpress.org/support/users/nikolagavric/)
 * (@nikolagavric)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/back-end-loading/)
 * Hi!
 * I’ve tried to get the datepicker to work in the admin/back end part. But I can’t.
   The plugin [@todo](https://wordpress.org/support/users/todo/) 0.4 says:
 * > // – Have options to enqueue scripts on front end and back end? Maybe in a 
   > future version when admin jQuery styles have been added to core.
 * So I guess it’s possible to do pretty easily, but what’s the correct way to do
   it?
 * / Niko
 * [https://wordpress.org/plugins/jquery-ui-widgets/](https://wordpress.org/plugins/jquery-ui-widgets/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [David Gwyer](https://wordpress.org/support/users/dgwyer/)
 * (@dgwyer)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/back-end-loading/#post-6534563)
 * Hi Niko,
 * There are still no core styles in the WordPress admin for jQuery UI even though
   all the scripts are available in core.
 * See this core trac ticket for more information: [https://core.trac.wordpress.org/ticket/18909](https://core.trac.wordpress.org/ticket/18909)
 * As you can see on the ticket someone has posted styles for the datepicker control
   to match the admin:
    [https://core.trac.wordpress.org/ticket/18909#comment:89](https://core.trac.wordpress.org/ticket/18909#comment:89)
 * It depends where you need the datepicker in the admin. If it’s for a theme or
   plugin options page then you’d probably be better to write your own code to enqueue
   the datepicker script for that page only and include the custom datepicker CSS
   I mentioned above.
 * You could also do this for all admin pages if that’s what you need.
 *  Thread Starter [nikolagavric](https://wordpress.org/support/users/nikolagavric/)
 * (@nikolagavric)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/back-end-loading/#post-6534575)
 * Thanks alot for the quick reply David.
 * It’s no problem for me to enque it for that page, and yes it’s for a plugin and
   option page.
 * So what I’ve done is just to include this:
 *     ```
       function load_custom_admin_scripts() {
       wp_enqueue_style( 'fib-css', plugins_url() . '/fib-plugin/css/style.css' );
       wp_enqueue_script( 'jquery-validate', plugins_url() . '/fib-plugin/js/jquery.validate.min.js', array(), '1.0.0', true );
       wp_enqueue_script( 'fib-scripts', plugins_url() . '/fib-plugin/js/scripts.js', array(), '1.0.0', true );
       }
       add_action( 'admin_enqueue_scripts', 'load_custom_admin_scripts' );
       ```
   
 * And in the your plugins option page I wrote the code:
 *     ```
       jQuery(document).ready(function($) {
       var dateToday = new Date();
       $( "#datepicker" ).datepicker({
       monthNames: ["Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"],
       monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"],
       dayNames: [ "Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag" ],
       dayNamesMin: [ "Sö", "Må", "Tis", "Ons", "Tors", "Fre", "Lö" ],
       dateFormat: "yy-mm-dd",
       firstDay: 1,
       minDate: dateToday
       });
       });
       ```
   
 * So should this be working if I just add the CSS above? Because right now it’s
   not, nothing happens when the #datepicker input is being clicked. Or do I have
   to put the code to initiate somewhere else instead?
 * BR / Niko
 *  Plugin Author [David Gwyer](https://wordpress.org/support/users/dgwyer/)
 * (@dgwyer)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/back-end-loading/#post-6534580)
 * If it’s for your own plugin then I’d strongly recommend you add the datepicker
   as part of your own plugin rather than rely on mine. For one thing it will be
   more portable if your plugin doesn’t require mine to function.
 * This might help to point you in the direction of adding the datepicker in the
   WordPress admin: [http://www.paulund.co.uk/add-date-picker-to-wordpress-admin](http://www.paulund.co.uk/add-date-picker-to-wordpress-admin)
 * So, add your own datepicker script and enqueue it with the core datepicker script
   as a dependency. See the above link for how to do this.
 * This should be enough to get you started.
 *  Thread Starter [nikolagavric](https://wordpress.org/support/users/nikolagavric/)
 * (@nikolagavric)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/back-end-loading/#post-6534581)
 * Great, will try to get it to work, thanks again David! 🙂
 *  Plugin Author [David Gwyer](https://wordpress.org/support/users/dgwyer/)
 * (@dgwyer)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/back-end-loading/#post-6534583)
 * No problem Niko. Good luck!
 *  Thread Starter [nikolagavric](https://wordpress.org/support/users/nikolagavric/)
 * (@nikolagavric)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/back-end-loading/#post-6534588)
 * Forgot to mark as resolved, -> done

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Back end loading?’ is closed to new replies.

 * ![](https://ps.w.org/jquery-ui-widgets/assets/icon.svg?rev=1430096)
 * [jQuery UI Widgets](https://wordpress.org/plugins/jquery-ui-widgets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/jquery-ui-widgets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/jquery-ui-widgets/)
 * [Active Topics](https://wordpress.org/support/plugin/jquery-ui-widgets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/jquery-ui-widgets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/jquery-ui-widgets/reviews/)

## Tags

 * [Backend](https://wordpress.org/support/topic-tag/backend/)
 * [datepicker](https://wordpress.org/support/topic-tag/datepicker/)
 * [jquery](https://wordpress.org/support/topic-tag/jquery/)
 * [ui](https://wordpress.org/support/topic-tag/ui/)

 * 6 replies
 * 2 participants
 * Last reply from: [nikolagavric](https://wordpress.org/support/users/nikolagavric/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/back-end-loading/#post-6534588)
 * Status: resolved