/** * Enqueue Admin JavaScript * * Note: CT Meta Box and other framework components handle their own scripts. * * @since 0.9 */ function ctfw_admin_enqueue_scripts() { $screen = get_current_screen(); // Widgets JavaScript // wp_enqueue_media() is run in classes/widget.php if ('widgets' == $screen->base) { // don't enqueue unless needed // New media uploader in WP 3.5+ wp_enqueue_media(); // Main widgets script wp_enqueue_script('ctfw-admin-widgets', ctfw_theme_url(CTFW_JS_DIR . '/admin-widgets.js'), array('jquery'), CTFW_THEME_VERSION); // bust cache on update wp_localize_script('ctfw-admin-widgets', 'ctfw_widgets', ctfw_admin_widgets_js_data()); // see admin-widgets.php } }
/** * Enqueue JavaScript for customizer controls * * @since 1.2 */ function ctfw_customize_enqueue_scripts() { // New media uploader in WP 3.5+ wp_enqueue_media(); // Main widgets script wp_enqueue_script('ctfw-admin-widgets', ctfw_theme_url(CTFW_JS_DIR . '/admin-widgets.js'), array('jquery'), CTFW_THEME_VERSION); // bust cache on update wp_localize_script('ctfw-admin-widgets', 'ctfw_widgets', ctfw_admin_widgets_js_data()); // see admin-widgets.php }