Posted By

FXDB on 11/29/11


Tagged

wordpress


Versions (?)

Loading jQuery from the Google CDN with wp_register_script


 / Published in: PHP
 

Adding this snippet to the functions.php of your wordpress theme will register and include jquery from the Google CDN.

  1. add_action( 'init', 'jquery_register' );
  2. function jquery_register() {
  3. if ( !is_admin() ) {
  4. wp_deregister_script( 'jquery' );
  5. wp_register_script( 'jquery', ( 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' ), false, null, true );
  6. wp_enqueue_script( 'jquery' );
  7. }
  8. }

Report this snippet  

You need to login to post a comment.