Enqueue stylesheet for jQuery UI from ajax.googleapis.com

CDN resources are useful for including common scripts, but the jquery ui script also requires the stylesheets. The following code will add the jqueryui stylesheets for the proper version that is included with wordpress.

$wp_scripts = wp_scripts();
wp_enqueue_style('plugin_name-admin-ui-css',
                'http://ajax.googleapis.com/ajax/libs/jqueryui/' . $wp_scripts->registered['jquery-ui-core']->ver . '/themes/smoothness/jquery-ui.css',
                false,
                PLUGIN_VERSION,
                false);

reference: https://stackoverflow.com/questions/8849684/wordpress-jquery-ui-css-files

Close Menu