I always, always have trouble getting jQuery to work in wordpress.
I really need some clarification and explination on just how this thing works.
Here is my code and I can’t seem to see what is wrong with it.
In the functions.php file:
function my_init() {
if (!is_admin()) {
// comment out the next two lines to load the local copy of jQuery
// wp_deregister_script('jquery');
// wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', false, '1.3.2');
wp_enqueue_script('jquery');
} } add_action('init', 'my_init');
And this is in my footer before I call my other jQuery scripts:
<?php wp_enqueue_script("jquery"); ?>
There’re some answers in this post also.
I’ve encountered this also in the past, and I usually don’t even use the wordpress own jquery if needed. Because the serverside google method is faster. This code below has to work.
functions.php
Make sure that wp_head(); is in your header.php file.
header.php
You don’t need to call the other jquery scripts in the footer that way. If you’re enqueueing lets say jquery UI scripts then make sure you have
wp_footer(); in your footer.php file.
footer.php