Latest Updates » [1] Auto XML Sitemap [2] Create Contact Page [3] Blogger and Wordpress Templates! Download Now !


Wednesday 28 August 2013

TRICK: Way for Google CDN jQuery Load in WP



TRICK: Way for Google CDN jQuery Load in WP
Using all inbuilt functions in WordPress may slow down your word press site. It is best idea to use external jQuery using like Google CDN etc.

By default, WordPress load its own copy of jQuery in your theme. But what about loading the library from Google CDN? Here’s an easy way to do it.

This very simple word press snippet can help you to load jQuery library from Google CDN. Follow the instructions to use the snippet.



Paste the code below into your functions.php file:

function jquery_cdn() {
   if (!is_admin()) {
      wp_deregister_script('jquery');
      wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', false, '1.8.3');
      wp_enqueue_script('jquery');
   }
}
add_action('init', 'jquery_cdn');

Once you saved the file, WordPress will load jQuery from Google CDN.

Thanks to WP Tips.ru for this awesome wordrpess snippet!



Kindly Bookmark this Post using your favorite Bookmarking service:
Technorati Digg This Stumble Stumble Facebook Twitter

Advertise Here

2 comments:

  1. Thanks for sharing...

    ReplyDelete
  2. working great,really awesome tips thanks a lot for sharing with us...

    ReplyDelete


ABOUT THE AUTHOR

Hi! I am K Ajay, currently live in Chandigarh, India. A young Web Designer, Pro Blogger, Graphic Designer & an addicted Web Developer. I love working on Blogger and WordPress using CSS Tricks,and Web Designing. Read More...

FOLLOW US HERE


RANDOM POSTS

Bwidgets4all-Helping Bloggers with Blogging Tricks © 2013. All Rights Reserved | Free Blogger Templates | | Back to Top