Include jQuery in WordPress Theme

Avatar of Chris Coyier
Chris Coyier on (Updated on )

The following is the best way to go about it. Add the following to the theme’s functions.php file:

if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
   wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://", false, null);

Replace the URL with the location of what version of jQuery you want to use.