I am using a test environment to try to get jquery working in wordpress, the installation version is 3.2.1 and the theme is 2010 (although I have tried this in a few different themes, same result). There are no plug-ins installed.
Basically I am putting this in the header file to see if I can get jQuery to work.
<script type="text/javascript">
jQuery(document).ready(function(){
alert('test');
});
</script>
have also tried this
jQuery(document).ready(function($){
and this
$j=jQuery.noConflict();
// Use jQuery via $j(...)
$j(document).ready(function(){
alert('test');
});
I can not seem to get it to display the alert when the page loads. When I check firebug the script has loaded.
jQuery works fine when not used in conjunction with WP and all scripts tested outside of WP perform as expected.
Should it work in WP 3.2.1? What can I try?
EDIT:
The answer below was not intended as step-by-step instructions about how to add jQuery to WordPress. I’m simply asking him to check and see if it’s already there, then I’m telling him to “not include it again” IF it’s already there.
As mentioned in comments, wp_enqueue_script is the absolute best way to add jQuery to WordPress, whenever you need to add jQuery.
Of course jQuery works within WordPress but I am not sure if it’s already included within the Twenty-Ten theme by default. Check to see if the script includes tags are there. You need something like this in the header someplace before you can call any JavaScript that uses jQuery…
(Make sure you’re not including it more than once or multiple versions.)