function jcf_admin_add_scripts() { wp_register_script('just_custom_fields', WP_PLUGIN_URL . '/just-custom-fields/assets/just_custom_fields.js', array('jquery', 'json2', 'jquery-form', 'jquery-ui-sortable')); wp_enqueue_script('just_custom_fields'); // add text domain wp_localize_script('just_custom_fields', 'jcf_textdomain', jcf_get_language_strings()); }
public function add_js() { global $wp_version; if ($wp_version <= 3.2) { // ui core wp_register_script('jcf-jquery-ui-core', WP_PLUGIN_URL . '/just-custom-fields/assets/jquery-ui.min.js', array('jquery')); wp_enqueue_script('jcf-jquery-ui-core'); wp_register_script('jcf_table', WP_PLUGIN_URL . '/just-custom-fields/components/table/table.js', array('jcf-jquery-ui-core')); wp_enqueue_script('jcf_table'); } else { wp_register_script('jcf_table', WP_PLUGIN_URL . '/just-custom-fields/components/table/table.js', array('jquery')); wp_enqueue_script('jcf_table'); } // add text domain if not registered with another component global $wp_scripts; wp_localize_script('jcf_table', 'jcf_textdomain', jcf_get_language_strings()); }
/** * add custom scripts */ function add_js() { /** * WP version 3.2 and below does not have autocomplete in ui-core */ global $wp_version; if ($wp_version <= 3.2) { // ui core wp_register_script('jcf-jquery-ui-core', WP_PLUGIN_URL . '/just-custom-fields/assets/jquery-ui.min.js', array('jquery')); wp_enqueue_script('jcf-jquery-ui-core'); // ui autocomplete wp_register_script('ui-autocomplete', WP_PLUGIN_URL . '/just-custom-fields/components/relatedcontent/assets/jquery-ui-1.8.14.autocomplete.min.js', array('jcf-jquery-ui-core')); wp_enqueue_script('ui-autocomplete'); // multi script wp_register_script('jcf_related_content', WP_PLUGIN_URL . '/just-custom-fields/components/relatedcontent/related-content.js', array('ui-autocomplete')); wp_enqueue_script('jcf_related_content'); } else { wp_register_script('jcf_related_content', WP_PLUGIN_URL . '/just-custom-fields/components/relatedcontent/related-content.js', array('jquery', 'jquery-ui-autocomplete')); wp_enqueue_script('jcf_related_content'); } // add text domain if not registered with another component global $wp_scripts; if (empty($wp_scripts->registered['jcf_fields_group']) && empty($wp_scripts->registered['jcf_uploadmedia'])) { wp_localize_script('jcf_related_content', 'jcf_textdomain', jcf_get_language_strings()); } }
/** * add custom scripts */ public function add_js() { global $pagenow, $wp_version, $post_ID; // only load on select pages if (!in_array($pagenow, array('post-new.php', 'post.php', 'media-upload-popup'))) { return; } wp_enqueue_media(array('post' => $post_ID ? $post_ID : null)); wp_enqueue_script("jcf-simpleupload-modal", WP_PLUGIN_URL . '/just-custom-fields/components/simplemedia/assets/simplemedia-modal.js', array('jquery', 'media-models')); // add text domain if not registered with another component global $wp_scripts; if (empty($wp_scripts->registered['jcf_fields_group']) && empty($wp_scripts->registered['jcf_related_content'])) { wp_localize_script('jcf_simplemedia', 'jcf_textdomain', jcf_get_language_strings()); } }
/** * add custom scripts */ function add_js() { // ui autocomplete // TODO: check that autocomplete is realy required wp_register_script('ui-autocomplete', WP_PLUGIN_URL . '/just-custom-fields/components/relatedcontent/assets/jquery-ui-1.8.14.autocomplete.min.js', array('jquery', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position')); wp_enqueue_script('ui-autocomplete'); // multi script wp_register_script('jcf_related_content', WP_PLUGIN_URL . '/just-custom-fields/components/relatedcontent/related-content.js', array('jquery')); wp_enqueue_script('jcf_related_content'); // add text domain if not registered with another component global $wp_scripts; if (empty($wp_scripts->registered['jcf_fields_group']) && empty($wp_scripts->registered['jcf_uploadmedia'])) { wp_localize_script('jcf_related_content', 'jcf_textdomain', jcf_get_language_strings()); } }
/** * add custom scripts */ public function add_js() { wp_register_script('jcf_fields_group', WP_PLUGIN_URL . '/just-custom-fields/components/fieldsgroup/fields-group.js', array('jquery')); wp_enqueue_script('jcf_fields_group'); // add text domain if not registered with another component global $wp_scripts; if (empty($wp_scripts->registered['jcf_related_content']) && empty($wp_scripts->registered['jcf_uploadmedia'])) { wp_localize_script('jcf_fields_group', 'jcf_textdomain', jcf_get_language_strings()); } }