How to Include jQuery in Your WordPress Thesis Blog

by Justin on July 2, 2011

The Thesis wordpress theme comes with the option to include jQuery in a site-wide fashion or just on the home page. I checked that option out and it’s including jQuery 1.4.2, which is kind of old, since jQuery is at 1.6.2 as of right now. So I wanted to be able to include my own jQuery to make it more recent. Here is how I did that.

Copy the code below into your custom_functions.php:

1
2
3
4
5
6
function footerscripts() {
?>
<script src="<?php bloginfo('template_url'); ?" type="text/javascript">/custom/js/jquery-1.6.2.js"></script>
< ?
}
add_action('thesis_hook_after_footer', 'footerscripts');

Of course you could use one of the CDN hosted jQuery libraries and just use their version.

After I include the jQuery library I usually next include any scripts I need. I steer clear of putting javascript in the file itself and prefer to link it to an external javascript file, like I do on this site.

I hope this helped you figure out how to include jQuery in your thesis theme. Your comments are welcome.

Previous post: