/** * Enqueue scripts and styles. * * @since Twenty Fifteen 1.0 */ function montkailash_scripts() { // Load our main stylesheet. wp_enqueue_style('bootstrap-style', get_template_directory_uri() . '/css/bootstrap.min.css'); wp_enqueue_style('bootstrap-style', get_template_directory_uri() . '/css/bootstrap-theme.min.css'); wp_enqueue_style('lightbox-style', get_template_directory_uri() . '/css/lightbox.css'); wp_enqueue_style('montkailash-style', get_stylesheet_uri()); if (is_page('Contact')) { wp_register_script('gmap', "http://maps.google.com/maps/api/js?sensor=true", '', '', true); wp_enqueue_script('gmap'); wp_enqueue_script('gmaps', get_template_directory_uri() . '/js/gmaps.js', array('jquery'), '', true); wp_enqueue_script('function-map', get_template_directory_uri() . '/js/function_map.js', array('jquery'), '0.1', true); } if (!is_admin()) { wp_deregister_script('jquery'); wp_register_script('jquery', "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js", '', '1.8.3', true); wp_enqueue_script('jquery'); wp_deregister_script('wonderplugin-slider-skins-script'); wp_deregister_script('wonderplugin-slider-script'); wp_deregister_script('wonderplugin-slider-creator-script'); wp_deregister_script('woo-vou-public-script'); wp_register_script('wonderplugin-slider-skins-script', plugins_url() . '/wonderplugin-slider/engine/wonderpluginsliderskins.js', array('jquery'), '4.9', true); wp_register_script('wonderplugin-slider-script', plugins_url() . '/wonderplugin-slider/engine/wonderpluginslider.js', array('jquery'), '4.9', true); wp_register_script('wonderplugin-slider-creator-script', plugins_url() . '/wonderplugin-slider/app/wonderplugin-slider-creator.js', array('jquery'), '4.9', true); wp_register_script('woo-vou-public-script', plugins_url() . '/woocommerce-pdf-vouchers/includes/js/woo-vou-public.js', array('jquery'), '2.4.4', true); wp_enqueue_script('bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '20150330', true); wp_enqueue_script('lightbox', get_template_directory_uri() . '/js/lightbox.js', array('jquery'), '2.8.1', true); wp_enqueue_script('montkailash-script', get_template_directory_uri() . '/js/functions.js', array('jquery'), '0.1', true); } }
/** * Load Google Maps API * * Determine if Google Maps API script has already been loaded * @since : 1.0.3 * @return bool $multiple_google_maps_api */ public function check_for_multiple_google_maps_api_calls() { global $wp_scripts; if (!$wp_scripts) { return false; } //loop through registered scripts foreach ($wp_scripts->registered as $registered_script) { //find any that have the google script as the source, ensure it's not enqueud by this plugin if (strpos($registered_script->src, 'maps.googleapis.com/maps/api/js') !== false && strpos($registered_script->handle, 'google-maps-builder') === false || strpos($registered_script->src, 'maps.google.com/maps/api/js') !== false && strpos($registered_script->handle, 'google-maps-builder') === false) { //Remove this script from loading wp_deregister_script($registered_script->handle); wp_dequeue_script($registered_script->handle); $this->google_maps_conflict = true; //ensure we can detect scripts on the frontend from backend; we'll use an option to do this if (!is_admin()) { update_option('gmb_google_maps_conflict', true); } } } //Ensure that if user resolved conflict on frontend we remove the option flag if ($this->google_maps_conflict === false && !is_admin()) { update_option('gmb_google_maps_conflict', false); } }
function core_mods() { if ( !is_admin() ) { wp_deregister_script('jquery'); wp_register_script('jquery', ("//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"), false); wp_enqueue_script('jquery'); } }
function takeaway_register_woo_radio_button_scripts() { wp_deregister_script('wc-add-to-cart-variation'); wp_dequeue_script('wc-add-to-cart-variation'); wp_register_script('takeaway-add-to-cart-variation', UOU_JS . 'add-to-cart-variation.min.js', array('jquery'), $ver = false, true); wp_enqueue_script('takeaway-add-to-cart-variation'); }
function foundationpress_scripts() { // Enqueue Main Stylesheet wp_enqueue_style('Main Stylesheet', get_stylesheet_directory_uri() . '/css/foundation.css'); // Deregister the jquery version bundled with wordpress wp_deregister_script('jquery'); // Modernizr is used for polyfills and feature detection. Must be placed in header. (Not required) wp_register_script('modernizr', get_template_directory_uri() . '/js/vendor/modernizr.js', array(), '2.8.3', false); // Fastclick removes the 300ms delay on click events in mobile environments. Must be placed in header. (Not required) wp_register_script('fastclick', get_template_directory_uri() . '/js/vendor/fastclick.js', array(), '1.0.0', false); // CDN hosted jQuery placed in the header, as some plugins require that jQuery is loaded in the header. wp_enqueue_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js', array(), '2.1.0', false); // Self hosted jQuery placed in the footer. (Comment the script above and uncomment the script below if you want to switch). //wp_register_script( 'jquery', get_template_directory_uri() . '/js/vendor/jquery.js', array(), '2.1.3', true ); // If you'd like to cherry-pick the foundation components you need in your project, head over to Gruntfile.js and see lines 67-88 // It's a good idea to do this, performance-wise. No need to load everything if you're just going to use the grid anyway, you know :) wp_register_script('foundation', get_template_directory_uri() . '/js/foundation.js', array('jquery'), '5.5.1', true); wp_register_script('troispointszero', get_template_directory_uri() . '/js/custom/troispointzero.js', array('jquery'), '1.0'); // Enqueue all registered scripts wp_enqueue_script('modernizr'); wp_enqueue_script('fastclick'); wp_enqueue_script('jquery'); wp_enqueue_script('foundation'); wp_enqueue_script('troispointszero'); }
function site_scripts() { global $wp_styles; // Call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way // Removes WP version of jQuery wp_deregister_script('jquery'); // Load jQuery files in header - load in header to avoid issues with plugins wp_enqueue_script('jquery', get_template_directory_uri() . '/vendor/jquery/dist/jquery.min.js', array(), '', true); // Load What-Input files in footer wp_enqueue_script('what-input', get_template_directory_uri() . '/vendor/what-input/what-input.min.js', array(), '', true); // Adding Foundation scripts file in the footer wp_enqueue_script('foundation-js', get_template_directory_uri() . '/assets/js/foundation.min.js', array('jquery'), '6.0', true); // Adding scripts file in the footer wp_enqueue_script('site-js', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery'), '', true); // Register main stylesheet wp_enqueue_style('site-css', get_template_directory_uri() . '/assets/css/style.min.css', array(), '', 'all'); // Register custom stylesheet wp_enqueue_style('dragoncove-css', get_template_directory_uri() . '/assets/css/dragoncove-style.css', array(), '', 'all'); // Register custom stylesheet wp_enqueue_style('dragoncove-woocommerce-css', get_template_directory_uri() . '/assets/css/dragoncove-woocommerce.css', array(), '', 'all'); // Comment reply script for threaded comments if (is_singular() and comments_open() and get_option('thread_comments') == 1) { wp_enqueue_script('comment-reply'); } }
/** * Enqueue scripts and stylesheets * * Enqueue stylesheets in the following order: * 1. /theme/assets/css/main.min.css * * Enqueue scripts in the following order: * 1. jquery-1.11.0.min.js via Google CDN * 2. /theme/assets/js/vendor/modernizr-2.7.2.min.js * 3. /theme/assets/js/main.min.js (in footer) */ function alfath_scripts() { wp_enqueue_style('alfath_main', get_template_directory_uri() . '/assets/css/main.min.css', false, '1.0.0'); wp_enqueue_style('alfath_fa-icon', get_template_directory_uri() . '/assets/css/font-awesome.min.css', false, '4.0.3'); wp_enqueue_style('alfath-icon', get_template_directory_uri() . '/assets/css/alfath-icon.min.css', false, '1.0.0'); if (file_exists(get_template_directory() . '/assets/css/custom.css')) { wp_enqueue_style('alfath_custom', get_template_directory_uri() . '/assets/css/custom.css', array('alfath_main'), filemtime(get_template_directory() . '/assets/css/custom.css'), 'all'); } // jQuery is loaded using the same method from HTML5 Boilerplate: // Grab Google CDN's latest jQuery with a protocol relative URL; fallback to local if offline // It's kept in the header instead of footer to avoid conflicts with plugins. if (!is_admin() && current_theme_supports('jquery-cdn')) { wp_deregister_script('jquery'); wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js', false, null, false); add_filter('script_loader_src', 'alfath_jquery_local_fallback', 10, 2); } if (is_single() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } wp_register_script('modernizr', get_template_directory_uri() . '/assets/js/vendor/modernizr-2.7.2.min.js', false, null, false); wp_register_script('jquery-migrate', get_template_directory_uri() . '/assets/js/vendor/jquery-migrate-1.2.1.min.js', array('jquery'), null, false); wp_register_script('alfath_scripts', get_template_directory_uri() . '/assets/js/scripts.min.js', false, '1.0.0', true); wp_enqueue_script('modernizr'); wp_enqueue_script('jquery'); wp_enqueue_script('jquery-migrate'); wp_enqueue_script('alfath_scripts'); }
function disable_autosave() { global $post; if (get_post_type($post->ID) === 'newsletter') { wp_deregister_script('autosave'); } }
function joints_scripts_and_styles() { global $wp_styles; // Call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way if (!is_admin()) { $theme_version = wp_get_theme()->Version; // Removes WP version of jQuery wp_deregister_script('jquery'); // Loads jQuery from bower_components wp_enqueue_script('jquery', get_template_directory_uri() . '/bower_components/foundation/js/vendor/jquery.js', array(), '2.1.3', true); // Modernizr from bower_components wp_enqueue_script('modernizr', get_template_directory_uri() . '/bower_components/foundation/js/vendor/modernizr.js', array(), '2.8.3', true); // Adding Foundation scripts file in the footer wp_enqueue_script('foundation-js', get_template_directory_uri() . '/assets/js/min/foundation.min.js', array('jquery'), '', true); // Adding scripts file in the footer wp_enqueue_script('site-js', get_template_directory_uri() . '/assets/js/min/scripts.min.js', array('jquery'), '', true); // Register main stylesheet wp_enqueue_style('site-css', get_template_directory_uri() . '/assets/css/style.css', array(), '', 'all'); // Register foundation icons // wp_enqueue_style( 'foundation-icons', get_template_directory_uri() . '/assets/css/icons/foundation-icons.css', array(), '3.0', 'all' ); // Comment reply script for threaded comments if (is_singular() and comments_open() and get_option('thread_comments') == 1) { wp_enqueue_script('comment-reply'); } } }
function januas_enqueue_scripts() { wp_deregister_script('jquery'); wp_register_script('jquery', get_stylesheet_directory_uri() . '/lib/scripts/jquery-1.8.3.js'); wp_register_script('jquery-ui', get_stylesheet_directory_uri() . '/lib/scripts/jquery-ui-1.9.2.custom.min.js'); wp_register_style('januas-ie-only', get_stylesheet_directory_uri() . '/lib/styles/ie.css', array(), ''); wp_enqueue_script('januas-modernizr', get_stylesheet_directory_uri() . '/lib/scripts/modernizr.custom.min.js', array(), '2.5.3', false); wp_enqueue_script('januas-chosen', get_stylesheet_directory_uri() . '/lib/scripts/chosen.jquery.min.js', array('jquery')); wp_enqueue_script('januas-watermark', get_stylesheet_directory_uri() . '/lib/scripts/jquery.watermark.min.js', array('jquery')); wp_register_script('januas-bx-jquery', get_stylesheet_directory_uri() . '/lib/scripts/jquery.bxslider.min.js'); wp_enqueue_style('januas-bx-style', get_stylesheet_directory_uri() . '/lib/styles/jquery.bxslider.css'); wp_enqueue_style('januas-fontawesome', get_template_directory_uri() . '/lib/styles/font-awesome.min.css'); wp_enqueue_style('januas-bx-custom', get_stylesheet_directory_uri() . '/lib/styles/bx.custom.css'); wp_enqueue_style('januas-chosen-style', get_stylesheet_directory_uri() . '/lib/styles/chosen.css'); wp_enqueue_style('januas-ie-only'); wp_enqueue_script('januas-bx-jquery'); if (is_singular() && comments_open() && get_option('thread_comments') == 1) { wp_enqueue_script('comment-reply'); } if (is_singular('ja-event')) { wp_enqueue_script('januas-google-maps', 'https://maps.google.com/maps/api/js?sensor=false'); global $post; if (get_post_meta($post->ID, 'januas_map_visible', true) == 'y') { wp_enqueue_script('januas-event-map', get_stylesheet_directory_uri() . '/lib/scripts/januas-event-map.js', false, true); } wp_enqueue_script('januas-lightbox', get_stylesheet_directory_uri() . '/lib/scripts/jquery.lightbox-0.5.min.js', array('jquery')); wp_enqueue_style('januas-lightbox', get_stylesheet_directory_uri() . '/lib/styles/jquery.lightbox-0.5.css'); } wp_enqueue_script('januas-woocommerce', get_template_directory_uri() . '/lib/scripts/woocommerce.js', array('jquery'), false, false); }
/** * Enqueue scripts and stylesheets * * Enqueue stylesheets in the following order: * 1. /theme/assets/css/bootstrap.css * 2. /theme/assets/css/bootstrap-responsive.css * 3. /theme/assets/css/virtue.css * 4. /theme/assets/css/skin.css * * Enqueue scripts in the following order: * 1. jquery-1.9.1.min.js via Google CDN * 2. /theme/assets/js/vendor/modernizr-2.6.2.min.js * 3. /theme/assets/js/plugins.js (in footer) * 4. /theme/assets/js/main.js (in footer) */ function kadence_scripts() { wp_enqueue_style('kadence_bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.css', false, "204"); wp_enqueue_style('kadence_theme', get_template_directory_uri() . '/assets/css/virtue.css', false, "204"); global $virtue; if (isset($virtue['skin_stylesheet'])) { $skin = $virtue['skin_stylesheet']; } else { $skin = 'default.css'; } wp_enqueue_style('virtue_skin', get_template_directory_uri() . '/assets/css/skins/' . $skin . '', false, null); if (is_child_theme()) { wp_enqueue_style('roots_child', get_stylesheet_uri(), false, null); } if (is_single() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } wp_register_script('modernizr', get_template_directory_uri() . '/assets/js/vendor/modernizr-2.6.2.min.js', false, null, false); wp_register_script('kadence_plugins', get_template_directory_uri() . '/assets/js/plugins.js', false, '200', true); wp_register_script('kadence_main', get_template_directory_uri() . '/assets/js/main.js', false, null, true); wp_enqueue_script('jquery'); wp_enqueue_script('modernizr'); wp_enqueue_script('kadence_plugins'); wp_enqueue_script('kadence_main'); if (class_exists('woocommerce')) { wp_deregister_script('wc-add-to-cart-variation'); wp_register_script('wc-add-to-cart-variation', get_template_directory_uri() . '/assets/js/add-to-cart-variation-ck.js', array('jquery'), false, '200', true); wp_localize_script('wc-add-to-cart-variation', 'wc_add_to_cart_variation_params', apply_filters('wc_add_to_cart_variation_params', array('i18n_no_matching_variations_text' => esc_attr__('Sorry, no products matched your selection. Please choose a different combination.', 'woocommerce'), 'i18n_unavailable_text' => esc_attr__('Sorry, this product is unavailable. Please choose a different combination.', 'woocommerce')))); wp_enqueue_script('wc-add-to-cart-variation'); } }
/** * Load scripts * * @since 1.6.0 */ public function scripts($hook) { if (WPEX_ADMIN_PANEL_HOOK_PREFIX . '-custom-js' == $hook) { wp_deregister_script('ace-editor'); wp_enqueue_script('wpex-ace-editor', WPEX_FRAMEWORK_DIR_URI . 'addons/assets/ace.js', array(), true); } }
public function enqueue_scripts() { parent::enqueue_scripts(); wp_deregister_script('cmb-google-maps-script'); wp_enqueue_script('cmb-google-maps-script', trailingslashit(WP_TALENTS_URL) . 'js/field-gmap.js', array('jquery', 'cmb-google-maps')); wp_localize_script('cmb-google-maps-script', 'CMBGmaps', array('defaults' => array('latitude' => $this->args['default_lat'], 'longitude' => $this->args['default_long'], 'zoom' => $this->args['default_zoom']), 'strings' => array('markerTitle' => $this->args['string-marker-title']))); }
/** * Scripts and stylesheets * * Enqueue stylesheets in the following order: * 1. /theme/assets/css/main.css * * Enqueue scripts in the following order: * 1. jquery-1.11.1.min.js via Google CDN * 2. /theme/assets/js/vendor/modernizr.min.js * 3. /theme/assets/js/scripts.js * * Google Analytics is loaded after enqueued scripts if: * - An ID has been defined in config.php * - You're not logged in as an administrator */ function roots_scripts() { /** * The build task in Grunt renames production assets with a hash * Read the asset names from assets-manifest.json */ wp_enqueue_style('google_fonts', 'https://fonts.googleapis.com/css?family=Oswald:400,700', false, null); wp_enqueue_style('font_awesome', '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css', false, '90912b55a3d6b2070ca68c801a5ef6bb'); if (WP_ENV === 'development') { $assets = array('css' => '/assets/css/main.css', 'js' => '/assets/js/scripts.js', 'modernizr' => '/assets/vendor/modernizr/modernizr.js', 'jquery' => '//code.jquery.com/jquery-1.11.1.min.js', 'owl_carousel' => '/assets/js/plugins/owl.carousel.js'); } else { $get_assets = file_get_contents(get_template_directory() . '/assets/manifest.json'); $assets = json_decode($get_assets, true); $assets = array('css' => '/assets/css/main.min.css?' . $assets['assets/css/main.min.css']['hash'], 'js' => '/assets/js/scripts.min.js?' . $assets['assets/js/scripts.min.js']['hash'], 'modernizr' => '/assets/js/vendor/modernizr.min.js', 'jquery' => '//code.jquery.com/jquery-1.11.1.min.js', 'owl_carousel' => '/assets/js/plugins/owl.carousel.js'); } wp_enqueue_style('roots_css', get_template_directory_uri() . $assets['css'], false, null); /** * jQuery is loaded using the same method from HTML5 Boilerplate: * Grab Google CDN's latest jQuery with a protocol relative URL; fallback to local if offline * It's kept in the header instead of footer to avoid conflicts with plugins. */ if (!is_admin() && current_theme_supports('jquery-cdn')) { wp_deregister_script('jquery'); wp_register_script('jquery', $assets['jquery'], array(), null, false); add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2); } if (is_single() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } wp_enqueue_script('modernizr', get_template_directory_uri() . $assets['modernizr'], array(), null, false); wp_enqueue_script('jquery'); wp_enqueue_script('roots_js', get_template_directory_uri() . $assets['js'], array(), null, false); }
function remove_useless_scripts() { // slideshow gallery lightbox is disabled via admin wp_deregister_script('jquery-flightbox'); wp_deregister_script('jquery-flightbox-css'); wp_deregister_script('flickr-gallery'); }
/** * Settings scripts */ public function enqueue_admin_scripts() { // deregister scripts wp_deregister_script('underscore'); wp_deregister_script('select2'); wp_deregister_script('backbone'); // register $external_libs = WC_POS_Template::get_external_js_libraries(); wp_register_script('underscore', $external_libs['lodash'], array('jquery'), null, true); wp_register_script('backbone', $external_libs['backbone'], array('jquery', 'underscore'), null, true); wp_register_script('backbone.radio', $external_libs['radio'], array('jquery', 'backbone', 'underscore'), null, true); wp_register_script('marionette', $external_libs['marionette'], array('jquery', 'backbone', 'underscore'), null, true); wp_register_script('handlebars', $external_libs['handlebars'], false, null, true); wp_register_script('moment', $external_libs['moment'], false, null, true); wp_register_script('accounting', $external_libs['accounting'], false, null, true); wp_register_script('select2', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js', array('jquery'), null, true); wp_register_script('idb-wrapper', $external_libs['idb-wrapper'], false, null, true); // enqueue wp_enqueue_script('jquery-ui-sortable'); $build = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? 'build' : 'min'; wp_enqueue_script(WC_POS_PLUGIN_NAME . '-admin-app', WC_POS_PLUGIN_URL . 'assets/js/admin.' . $build . '.js', array('backbone', 'backbone.radio', 'marionette', 'handlebars', 'accounting', 'moment', 'select2', 'idb-wrapper'), WC_POS_VERSION, true); wp_enqueue_script('eventsource-polyfill', WC_POS_PLUGIN_URL . 'assets/js/vendor/eventsource.min.js', array(), null, true); $scripts = apply_filters('woocommerce_pos_admin_enqueue_scripts', array()); if (isset($scripts['locale'])) { wp_enqueue_script(WC_POS_PLUGIN_NAME . '-js-locale', $scripts['locale'], array(WC_POS_PLUGIN_NAME . '-admin-app'), WC_POS_VERSION, true); } }
function ncsu_theme_scripts() { // Deregister the included library wp_deregister_script('jquery'); // Register jQuery again from Google's CDN wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js', array(), null, true); wp_register_script('ncsu-bootstrap', 'https://cdn.ncsu.edu/brand-assets/bootstrap/js/bootstrap.min.js', array('jquery'), null, true); wp_enqueue_script('ncsu-bootstrap'); /** * Uncomment to enqueue individual scripts (development) * */ /* wp_register_script('theme-main-js', get_template_directory_uri() . '/js/main.js', array('jquery'), null, true); wp_enqueue_script('theme-main-js'); wp_register_script('wp-mobile-nav', get_template_directory_uri() . '/js/ncstate-mobile-nav.js', array('jquery'), null, true); wp_enqueue_script('wp-mobile-nav'); wp_register_script('picture-fill', get_template_directory_uri(). '/js/picturefill.min.js'); wp_enqueue_script('picture-fill'); */ /** * Use minified js in production environments - * Uncomment the lines below if using non-minified scripts * */ wp_register_script('minified-js', get_template_directory_uri() . '/js/main.min.js', array('jquery'), null, true); wp_enqueue_script('minified-js'); }
public function add_jquery_cropper() { wp_deregister_script('jcrop'); wp_deregister_style('jcrop'); wp_enqueue_script('jcrop', plugin_dir_url(__FILE__) . '/assets/js/jquery.Jcrop.min.js', array('jquery'), '0.9.12', true); wp_enqueue_style('jcrop', plugin_dir_url(__FILE__) . '/assets/css/jquery.Jcrop.min.css', array(), '0.9.12', all); }
function bones_head_cleanup() { // remove header links remove_action('wp_head', 'feed_links_extra', 3); // Category Feeds remove_action('wp_head', 'feed_links', 2); // Post and Comment Feeds remove_action('wp_head', 'rsd_link'); // EditURI link remove_action('wp_head', 'wlwmanifest_link'); // Windows Live Writer remove_action('wp_head', 'index_rel_link'); // index link remove_action('wp_head', 'parent_post_rel_link', 10, 0); // previous link remove_action('wp_head', 'start_post_rel_link', 10, 0); // start link remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0); // Links for Adjacent Posts remove_action('wp_head', 'wp_generator'); // WP version if (!is_admin()) { wp_deregister_script('jquery'); // De-Register jQuery wp_register_script('jquery', '', '', '', true); // It's already in the Header } }
function remove_scripts() { wp_deregister_script('selection-sharer'); wp_deregister_script('flexslider'); wp_deregister_script('magnific-popup'); wp_deregister_script('mediaelement'); wp_deregister_script('fitvids'); wp_deregister_script('validate'); wp_deregister_script('share'); wp_deregister_script('socialstream'); wp_deregister_script('r-gallery'); wp_deregister_script('isotope'); wp_deregister_script('prettify'); wp_deregister_style('selection-sharer'); wp_deregister_style('flexslider'); wp_deregister_style('magnific-popup'); wp_deregister_style('mediaelement'); wp_deregister_style('elastislide'); wp_deregister_style('prettify'); wp_deregister_style('fontello'); wp_deregister_style('bootstrap'); wp_deregister_style('uniform'); wp_deregister_style('main'); wp_deregister_style('768'); wp_deregister_style('992'); wp_deregister_style('1200'); wp_deregister_style('1400'); wp_deregister_style('wp-fix'); // upgrade fluidbox wp_deregister_style('fluidbox'); wp_deregister_script('fluidbox'); wp_enqueue_script('throttle-debounce', '/wp-content/themes/collinmbarrett/jquery.ba-throttle-debounce.min.js', null, null, true); wp_enqueue_script('fluidbox2', '/wp-content/themes/collinmbarrett/jquery.fluidbox.min.js', null, null, true); }
function wildcat_scripts_styles() { wp_enqueue_style('theme-main', get_stylesheet_directory_uri() . '/style.less', array(), '1.11'); wp_deregister_style('mediaelement'); wp_deregister_script('mediaelement'); wp_deregister_script('wp-mediaelement'); }
function theme_init() { global $pagenow; // Assets version - on deploy we'll bump the version number if (get_option('asset_version') !== false) { // Update version using URL param (post deploy) if (isset($_GET['post_deploy_hook']) && $_GET['post_deploy_hook'] == "j2r39fwj") { update_option('asset_version', get_option('asset_version') + 0.1); plant_clearCache(); } $asset_version = get_option('asset_version'); } else { add_option('asset_version', 0.1, 'yes'); $asset_version = get_option('asset_version'); } // EOF - Assets version - on deploy we'll bump the version number if (!is_admin() && 'wp-login.php' !== $pagenow) { $themeUrl = get_stylesheet_directory_uri(); wp_register_script('modernizr', $themeUrl . (ENVIRONMENT !== 'local' ? '/js/modernizr-custom.min.js' : '/js/modernizr-custom.js'), false, $asset_version, false); wp_enqueue_script('modernizr'); wp_deregister_script('jquery'); wp_register_script('jquery', $themeUrl . (ENVIRONMENT !== 'local' ? '/js/vendors.min.js' : '/js/vendors.js'), false, $asset_version, true); wp_enqueue_script('jquery'); wp_register_script('site', $themeUrl . (ENVIRONMENT !== 'local' ? '/js/site.min.js' : '/js/site.js'), array('jquery'), $asset_version, true); wp_enqueue_script('site'); wp_register_style('style', $themeUrl . (ENVIRONMENT === 'local' ? '/style.min.css' : '/style.css'), array(), $asset_version); wp_enqueue_style('style'); if (defined('BUGHERD_PROJECT_KEY')) { add_action('wp_head', 'add_bugherd'); } add_action('wp_head', 'add_jsconstants'); } }
/** * Ladda script */ function dazake_load_script() { if (!is_admin()) { /** * Deregister wordpress scripts */ wp_deregister_script('jquery'); /** * wp_register_script( $handle, $src, $deps, $ver, $in_footer ); */ wp_register_script('jquery', 'http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js'); wp_register_script('modernizr', get_template_directory_uri() . '/js/libs/modernizr.js'); wp_register_script('bootstrap', get_template_directory_uri() . '/js/libs/bootstrap/js/bootstrap.min.js'); wp_register_script('less', get_template_directory_uri() . '/js/libs/less.js'); wp_register_script('main', get_template_directory_uri() . '/js/main.js'); /** * Laddar skripten vi registrerat ovan. */ wp_enqueue_script('jquery'); wp_enqueue_script('modernizr'); wp_enqueue_script('bootstrap'); wp_enqueue_script('less'); wp_enqueue_script('main'); /** * load stylesheet */ wp_enqueue_style('style', get_stylesheet_uri()); wp_enqueue_style('bootstrap', get_template_directory_uri() . '/js/libs/bootstrap/css/bootstrap.min.css'); wp_enqueue_style('bootstrap-responsive', get_template_directory_uri() . '/js/libs/bootstrap/css/bootstrap-responsive.min.css'); } }
/** * Scripts and stylesheets * * Enqueue stylesheets in the following order: * 1. /theme/assets/css/main.css * * Enqueue scripts in the following order: * 1. jquery-1.11.1.min.js via Google CDN * 2. /theme/assets/js/vendor/modernizr.min.js * 3. /theme/assets/js/scripts.js (in footer) * * Google Analytics is loaded after enqueued scripts if: * - An ID has been defined in config.php * - You're not logged in as an administrator */ function roots_scripts() { /** * The build task in Grunt renames production assets with a hash * Read the asset names from assets-manifest.json */ if (WP_ENV === 'development') { $assets = array('css' => '/assets/css/main.css', 'js' => '/assets/js/scripts.js', 'modernizr' => '/assets/vendor/modernizr/modernizr.js', 'jquery' => '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js'); } else { $get_assets = file_get_contents(get_template_directory() . '/assets/manifest.json'); $assets = json_decode($get_assets, true); $assets = array('css' => '/assets/css/main.min.css' . '?' . $assets['assets/css/main.min.css']['hash'], 'js' => '/assets/js/scripts.min.js' . '?' . $assets['assets/js/scripts.min.js']['hash'], 'modernizr' => '/assets/js/vendor/modernizr.min.js', 'jquery' => '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'); } wp_enqueue_style('roots_css', get_template_directory_uri() . $assets['css'], false, null); /** * jQuery is loaded using the same method from HTML5 Boilerplate: * Grab Google CDN's latest jQuery with a protocol relative URL; fallback to local if offline * It's kept in the header instead of footer to avoid conflicts with plugins. */ if (!is_admin() && current_theme_supports('jquery-cdn')) { wp_deregister_script('jquery'); wp_register_script('jquery', $assets['jquery'], array(), null, false); add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2); } if (is_single() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } wp_enqueue_script('modernizr', get_template_directory_uri() . $assets['modernizr'], array(), null, false); wp_enqueue_script('jquery'); wp_enqueue_script('roots_js', get_template_directory_uri() . $assets['js'], array(), null, true); }
function html5blank_header_scripts() { if ($GLOBALS['pagenow'] != 'wp-login.php' && !is_admin()) { if (HTML5_DEBUG) { // jQuery wp_deregister_script('jquery'); wp_register_script('jquery', get_template_directory_uri() . '/bower_components/jquery/dist/jquery.js', array(), '1.11.1'); // Conditionizr wp_register_script('conditionizr', get_template_directory_uri() . '/js/lib/conditionizr-4.3.0.min.js', array(), '4.3.0'); // Modernizr wp_register_script('modernizr', get_template_directory_uri() . '/bower_components/modernizr/modernizr.js', array(), '2.8.3'); wp_register_script('plugins', get_template_directory_uri() . '/js/plugin.js', array(), '1.0.0'); // Custom scripts wp_register_script('html5blankscripts', get_template_directory_uri() . '/js/scripts.js', array('conditionizr', 'modernizr', 'jquery', 'plugins'), '1.0.0'); //wp_enqueue_script('plugins'); // Enqueue Scripts wp_enqueue_script('html5blankscripts'); // If production } else { // Scripts minify wp_register_script('html5blankscripts-min', get_template_directory_uri() . '/js/scripts.min.js', array(), '1.0.0'); // Enqueue Scripts wp_enqueue_script('html5blankscripts-min'); } } }
/** * 调用类时执行的代码,替换js,添加自定义js * * @version 0.13.8.23 */ function __construct() { // add_action ( 'wp_enqueue_scripts', array ($this,'load_scripts' ) ); // 添加js脚本 // jQuery,注意看135行,使用了jQuery Migrate让jQuery 1.9向前兼容 wp_deregister_script('jquery-core'); wp_register_script('jquery-core', '//lib.sinaapp.com/js/jquery/2.0.3/jquery-2.0.3.min.js', array(), '2.0.3'); wp_deregister_script('jquery-migrate'); wp_register_script('jquery-migrate', '//lib.sinaapp.com/js/jquery.migrate/1.2.1/jquery-migrate-1.2.1.min.js', array(), '1.2.1'); // jQuery 插件 wp_deregister_script('jquery-color'); wp_register_script('jquery-color', '//cdnjs.cloudflare.com/ajax/libs/jquery-color/2.1.2/jquery.color.min.js', array('jquery'), '2.1.2', 1); wp_deregister_script('jcrop'); wp_register_script('jcrop', '//cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.Jcrop.min.js', array('jquery'), '0.9.12'); // Masonry,这个插件不需要jQuery也可以运行的,代码写法不一样而已 wp_deregister_script('jquery-masonry'); wp_register_script('jquery-masonry', '//cdnjs.cloudflare.com/ajax/libs/masonry/3.1.2/masonry.pkgd.js', array('jquery'), '3.1.2', 1); // 其它 wp_deregister_script('swfobject'); wp_register_script('swfobject', '//lib.sinaapp.com/js/swfobject/2.2/swfobject.js', array(), '2.2'); wp_deregister_script('json2'); wp_register_script('json2', '//lib.sinaapp.com/js/json2/json2.js', array(), '2011-02-23'); wp_deregister_script('underscore'); wp_register_script('underscore', '//lib.sinaapp.com/js/underscore/1.4.4/underscore-min.js', array(), '1.4.4', 1); wp_deregister_script('backbone'); wp_register_script('backbone', '//lib.sinaapp.com/js/backbone/1.0.0/backbone-min.js', array('underscore', 'jquery'), '1.0.0', 1); wp_deregister_script('mediaelement'); wp_register_script('mediaelement', '//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.13.2/js/mediaelement.min.js', array('jquery'), '2.13.1', 1); }
function custom_scripts() { wp_deregister_script('Script 1 Handle/Name'); wp_register_script('Script 1 Handle/Name', 'Script URL', array('Script Dependencies'), 'Script Version', false); wp_enqueue_script('Script 1 Handle/Name'); wp_register_script('Script 2 Handle/Name', 'Script URL', array('Script Dependencies'), 'Script Version', false); }
function tnl_add_nofollow() { wp_deregister_script('wplink'); wp_register_script('wplink', plugins_url('/inc/nofollow.min.js', __FILE__), array('jquery'), false, 1); wp_enqueue_script('wplink'); wp_localize_script('wplink', 'wpLinkL10n', array('title' => __('Insert/edit link'), 'update' => __('Update'), 'save' => __('Add Link'), 'noTitle' => __('(no title)'), 'labelTitle' => __('Title'), 'noMatchesFound' => __('No results found.'), 'noFollow' => __(' Add <code>rel="nofollow"</code> to link', 'title-and-nofollow-for-links'))); }
function ox_adding_scripts() { if (!function_exists('is_login_page')) { function is_login_page() { return !strncmp($_SERVER['REQUEST_URI'], '/wp-login.php', strlen('/wp-login.php')); } } if (!is_admin() && !is_login_page()) { /*removed wp-embed.min.js*/ wp_deregister_script('wp-embed'); /*jquery*/ wp_deregister_script('jquery'); $infooter = !is_page(array($order_form_pages)) ? true : false; wp_register_script('jquery', "http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js", false, '1.11.3', $infooter); wp_enqueue_script('jquery'); /*bootstrap*/ wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css'); /*slicknav menu*/ wp_enqueue_script('slicknav', get_template_directory_uri() . '/js/jquery.slicknav.min.js', array('jquery'), '', true); /*bxslider*/ wp_enqueue_style('bxslider', get_template_directory_uri() . '/css/jquery.bxslider.min.css'); wp_enqueue_script('bxslider', get_template_directory_uri() . '/js/jquery.bxslider.min.js', array('jquery'), '', true); /*zopim chat*/ wp_enqueue_script('zopim', get_template_directory_uri() . '/js/zopimClear.js', array('jquery'), '', true); /*custom css*/ wp_enqueue_style('custom', get_template_directory_uri() . '/style.css', array('bootstrap')); /*custom js*/ wp_enqueue_script('custom', get_template_directory_uri() . '/js/custom.js', array('jquery'), '', true); } }
/** * Enqueue admin scripts. */ function honeyfeathers_admin_script_enqueues() { wp_deregister_script('options-custom'); wp_register_script('options-custom', get_stylesheet_directory_uri() . '/lib/plugins/options-framework/js/options-custom.js', array('jquery', 'wp-color-picker'), Options_Framework::VERSION); wp_deregister_script('of-media-uploader'); wp_register_script('of-media-uploader', get_stylesheet_directory_uri() . '/lib/plugins/options-framework/js/media-uploader.js', array('jquery'), Options_Framework::VERSION); }