As almost everything, we do when using jQuery reads or manipulates the document object model (DOM), we need to make sure that we start adding events etc. as soon as the DOM is ready.
Use Google’s Copy Of JQuery in WordPress
Grabs jQuery from Google’s CDN which your visitors will hopefully have cached. This can then be called in your header with <?php wp_enqueue_script("jquery"); ?>
// Call the google CDN version of jQuery for the frontend // Make sure you use this with wp_enqueue_script('jquery'); in your header function itlc_jquery_enqueue() { wp_deregister_script('jquery'); wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null); wp_enqueue_script('jquery'); } if (!is_admin()) add_action("wp_enqueue_scripts", "itlc_jquery_enqueue", 11);