I am trying to load some of my scripts from CDNs like CDNjs and Google, The scripts are being loaded correctly, but for some reason I do not find, for each script I have two or even three HTTP request (For the same script), here is an example: http://tools.pingdom.com/fpt/#!/ePuR3Z/http://elbauldelprogramador.com.
I have notice that when I am logged in, all scripts are generating only one HTTP request.
Jquery from ajax.googleapis is generating two http request, and jquery.easing.min.js from cdnjs three.
The code is :
//Making jQuery Google API
function modify_jquery() {
if (!is_admin()) {
// comment out the next two lines to load the local copy of jQuery
wp_deregister_script('jquery');
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js', false, '2.0.3');
wp_enqueue_script('jquery');
}
}
add_action('init','modify_jquery');
I have a child theme and from his parent I have copied a function called wi_enqueue(). In the parent the function is like this:
add_action( 'wp_enqueue_scripts', 'wi_enqueue' );
if ( !function_exists('wi_enqueue') ) {
function wi_enqueue(){
/* ...*/
}
In my child function.php I have:
function wi_enqueue(){
global $wp_styles, $smof_data;
/* Enqueue */
wp_enqueue_script( 'wi-easing', '//cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js', array('jquery'), '1.3', true );
wp_enqueue_script( 'wi-touchswipe', '//cdnjs.cloudflare.com/ajax/libs/jquery.touchswipe/1.6.4/jquery.touchSwipe.min.js', array('jquery'), '1.3.3', true );
wp_enqueue_script( 'wi-autosize', '//cdnjs.cloudflare.com/ajax/libs/autosize.js/1.17.1/autosize-min.js', array('jquery'), '1.17.1', true );
wp_enqueue_script( 'wi-placeholder', '//cdnjs.cloudflare.com/ajax/libs/placeholders/2.1.0/placeholders.min.js', array('jquery'), '2.1.0', true );
wp_enqueue_script( 'wi-modernizr', get_template_directory_uri() . '/js/modernizr.custom.15463.js', array('jquery'), '2.6.2', true );
wp_enqueue_script( 'wi-waypoint', '//cdnjs.cloudflare.com/ajax/libs/waypoints/2.0.2/waypoints.min.js', array('jquery'), '2.0.2', true );
wp_enqueue_script( 'wi-tipsy', get_template_directory_uri() . '/js/jquery.tipsy.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'wi-fitvids', get_template_directory_uri() . '/js/jquery.fitvids.js', array('jquery'), '1.0', true );
wp_enqueue_script( 'wi-sidr', get_template_directory_uri() . '/js/jquery.sidr.min.js', array('jquery'), '1.1.1', true );
/* .... */
}