Include jQuery in your WordPress Theme

If you want to include jQuery in your WordPress Theme the best way to do it is the following. Add this code to the theme’s functions.php file:
if( !is_admin()){
wp_deregister_script('jquery');
wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"), false, '1.4.1');
wp_enqueue_script('jquery');}

Replace the URL with the location of what version of jQuery you want to use. The URL above (at the time of this writing) links to the latest version of jQuery on Google’s servers (v1.4.1).
Source: css-tricks.com/snippets/wordpress/include-jquery-in-wordpress-theme

Tags: , ,

Author: Galadriel

One Response to “Include jQuery in your WordPress Theme”

  1. Mathew says:

    Happy that I discovered your site, great information. I will bookmark and try to visit more frequently.

Leave a Comment