Tips, Google, wordpress, javascript, jQuery
wordpressSi have your WordPress blog, you’ll surely get tedious from time to time to your server the latest version of jQuery, and go change the call in the header.php time.
With this code, you can always download the latest updated version from CDN servers Google high speed without touching the code again!
Simply include this snippet in the functions.php file of your theme:
PLAIN TEXT
1.
if (! is_admin ()) (
2.
wp_deregister_script ( ‘jquery’);
3.
wp_register_script ( ‘jquery’, ( “http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js”), false,”);
4.
wp_enqueue_script ( ‘jquery’);
5.
)
This code searches for the latest jQuery on Google, and loading this version from the folder “/ jquery / 1 /” instead of from the folder of the version available on your site.
Use this code carefully, making sure it is compatible with their scripts. And if you see one that does not work, just erase the lines of code added.
Leave a Reply