JQuery with functions.php doesn't always work
Closed this issue · 5 comments
I've used multiple sliders and JQuery plugins that don't work unless JQuery is loaded in the < head >. Is this something I should be doing differently or is it not meant to work this way?
Are you running jQuery in noconflict mode?
I'm not sure. I have it setup however it is when you download the files. See below.
// Load jQuery
if ( !function_exists(core_mods) ) {
function core_mods() {
if ( !is_admin() ) {
wp_deregister_script('jquery');
wp_register_script('jquery', ("//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"), false);
wp_enqueue_script('jquery');
}
}
core_mods();
}
Try replacing:
wp_register_script('jquery', ("//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"), false);
with
wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"), false);
Yeah, it's an annoying situation that I've submitted a patch to resolve in 3.4 that you can't use //domain.com/ references in wp_register_script or wp_register_style.
In the mean time, I'd suggest using something like ...
wp_register_script('jquery', (is_ssl()?'https':'http').'://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js', false);