Calling jQuery 1.4.2 via wordpress


/ Published in: PHP
Save to your folder(s)

This is a custom function to place in your theme's "functions.php" file that will override the typical 1.3.2 version of jQuery included in wordpress with the latest 1.4.2 version (and any future release for that matter). This does not effect the admin section as it has been removed via ' !is_admin()'


Copy this code and paste it in your HTML
  1. <?php // Call version 1.4.2 instead of 1.3.2. from Wordpress
  2.  
  3. function jquery_latest() {
  4. if ( !is_admin()) {
  5. wp_deregister_script( 'jquery' );
  6. wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js', false, '1.4.2' );
  7. }
  8. }
  9. add_action('init', 'jquery_latest');
  10. // Call in head
  11. wp_enqueue_script( 'jquery' );

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.