jQuery is used a lot to make effects, like dropping down a menu.
WP theme developers choose jQuery not only because it’s popular, but also because it comes together with WordPress, just in the
wp-includes/
js/jquery folder, WordPress uses it widely in the admin panel. So just check the home page source, if you can find ‘/
wp-includes/
js/jquery/jquery.
js’, then your
wp theme needs jQuery.
jQuery is a big library, over 50K normally, loading it from somewhere else not only saves your bandwidth, but also increases the page speed, as normally the brower won’t generate too many requests to the same sever at the same time. And even better, this “somewhere else” is Google, which is fast and stable!
Here it is, the latest jQuery from Google:
http://ajax.googleapis.com/ajax/libs.../jquery.min.js
here is the documents.
So now, you just need to replace the jQuery path from ‘
http://yourserver/wp-includes/js/jquery/jquery.js’ to ‘
http://ajax.googleapis.com/ajax/libs...jquery.min.js’.
Firstly, please check the header.php file in the theme folder you use. If you find the jquery path, well, you can just replace that.
If not, well, it must be generated by the function wp_head(). Here is what you need to do:
Check the functions.php file in the same folder, find something like this:
function my_jquery_init() {
wp_enqueue_script('jquery');
}
The key part is “wp_enqueue_script('jquery')“, if not find this, try to find “jquery.
js”. What we want to do here is to remove the code that generate the jQuery script tag, like just removing the line “wp_enqueue_script('jquery');“.
Then add this line to the header.php, just before </head>:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.
js"></script>
Now, check the page source, make sure the jQuery path been replaced.