You are viewing a post from electro kami classic - hello!

WordPress multiple jQuery inclusion fix

wordpress jquery multiple loading

loading the library just once is sufficient

WordPress loads jQuery more than once

Ever look at your WordPress page in Firebug and notice that jQuery is sometimes loaded more than once? Have you ever tried to use the Google jQuery content delivery network to improve page load speeds only to be thwarted by a second jQuery file that cannot be found inside your header.php file?

We can fix that!

Here is a smart loading jQuery main file that prevents multiple jQuery inclusions in your WordPress pages (and uses the Google Libraries API content distribution network), making your pages load quicker and more efficiently.

Just put this in at the top of your functions file:
if( !is_admin()){
wp_register_script(‘jquery’, (""), false, ‘1.6.2’);

If you download our functions file below, it would be best to copy over the contents of this file into your existing functions.php file so as not to mess up your theme’s other processes (but you are welcome to replace it too).

Once you add in the code from our file, you’re done! No need to do anything else!


Also included in the download file are two bonus functions, one that will create a dynamic copyright based on your WordPress post history (year of earliest post to year of newest), and another that will include your Google Analytics tracking into your page footer.

To use the copyright function, paste this into you footer.php:
<?php echo iw_copyright();?>

and to use the Google Analytics function, paste this into your footer:
<?php add_googleanalytics();?>

Grab it while it’s hot!

Download jQuery WordPress fix

Support and questions

Please direct any inquires for this file in the comments below.