Posted By

nerdfiles on 07/27/09


Tagged

php wordpress jquery


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

mmd
Onfire60
umang_nine
LeeRJohnson
depiction


Manually load (Google's) Latest jQuery in Wordpress


 / Published in: PHP
 

URL: http://encosia.com/2008/12/10/3-reasons-why-you-should-let-google-host-jquery-for-you/

The URL is normative and has nothing to do with the Source. Because so many blog posts with so few solutions (either outmoded or simply not relevant).

This allows you to prevent Wordpress's $script->add(); function (in "wp-includes/script-loader.php") from loading jQuery; then you can load Google's stored copy of jQuery (with gzip, so that you get the as-advertised 19kb, depending on server specifications, though).

  1. <?php wp_deregister_script('jquery'); ?>
  2. <?php wp_head(); ?>
  3. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: owlz on January 2, 2010

Work's great! Thanks!

Posted By: G470 on July 5, 2011

Thank you for that! Really a useful snippet.

You need to login to post a comment.