Linking to Jquery the right way
-
Hey all,
I’m sure this has been brought up a million times, but I can’t really find a whole lot of detailed info on how to correctly call the main jquery library that ships with wordpress, and how to then call a jquery plugin or two.(not a wordpress plugin) I have seen the wp_enqueue_script() method and have tried it all over the place. In the header.php, in the footer.php, and in the functions.php file. Nothing will work for me. In my theme, I’m currently just linking directly to all jquery files that I need, since I can’t get the right method to work. I would like to learn what I’m doing wrong. So am I to use the wp_enqueue_script method anywhere that I need the call jquery in my theme? I was reading that I should call it by getting it from the functions.php file?! I’m lost! I have this in my current theme’s function.php file:
if ( !is_admin() ) {
wp_deregister_script(‘jquery’);
wp_register_script(‘jquery’, (“https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js”), false);
wp_enqueue_script(‘jquery’);
}So how do I actually use that and call that from my header.php page?
And then how would I link to a certain jquery plugin file that I need to also use? Which I would prefer to call from my footer.php file.
- The topic ‘Linking to Jquery the right way’ is closed to new replies.