[wd_asp elements=’search’ ratio=’100%’ id=1]

Load jquery only once – WordPress

22nd June 2013

Wordpress - Miscellaneous

wordpress category

Add this to the bottom of your functions file, it is the only call to jquery you will need, you can change the version if needed.


// jquery call
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_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');
}

To test it just add this anywhere you choose….

From then on just use document ready script to start a jquery function….