<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Themocracy WordPress Themes &#187; jquery</title>
	<atom:link href="http://themocracy.com/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://themocracy.com</link>
	<description>WordPress Theme Design</description>
	<lastBuildDate>Mon, 26 Jul 2010 06:18:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A jQuery Slideshow for WordPress 2.9</title>
		<link>http://themocracy.com/2010/02/jquery-slideshow-wordpress/</link>
		<comments>http://themocracy.com/2010/02/jquery-slideshow-wordpress/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 11:03:46 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[thumbnails]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=248</guid>
		<description><![CDATA[You want a jQuery slideshow for your WordPress blog? - on the front page, or maybe in the sidebar? No real problem, all the javascript is taken of with the help of a jQuery plugin, all we have to do is figure out how to get the post data. 

And to keep things really simple, this is going to use the thumbnail functions in WP 2.9 - no need to mess around with custom fields any more. ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fjquery-slideshow-wordpress%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fjquery-slideshow-wordpress%2F" height="61" width="51" /></a></div><p><img class="alignright size-medium wp-image-249" title="jquery-slideshow" src="http://themocracy.com/wp-content/uploads/2010/02/jquery-slideshow-300x206.gif" alt="jquery slideshow" width="245" height="168" /><strong>You want a jQuery slideshow for your WordPress blog? </strong>- on the front page, or maybe in the sidebar? No real problem, all the javascript is taken of with the help of a jQuery plugin, all we have to do is figure out how to get the post data.</p>
<p>And to keep things really simple, this is going to use the thumbnail functions in WP 2.9 &#8211; no need to mess around with custom fields any more.<br />
<span id="more-248"></span><br />
Firstly, you do have to explicitly declare the new thumbnail system in <strong>functions.php</strong> &#8211; and best to wrap it up in an &#8220;if function exists&#8221; to avoid problems for older WP installs.</p>
<pre class="brush: php">
if (function_exists(&#039;add_theme_support&#039;)) {
add_theme_support( &#039;post-thumbnails&#039; );
add_image_size(&#039;slideshow-image&#039;, 300, 160); // for front page slideshow
}
</pre>
<p>The smart move is to define a &#8220;Featured&#8221; category &#8211; any post in that category will be available for the slideshow, and that&#8217;s the selection taken care of. Create a category &#8211; call it featured, or anything, but make a note of the cat_ID &#8211; mouseover a category on the admin categories page and it&#8217;ll be in the url, something like:</p>
<blockquote><p>http://testblog.com/wp-admin/categories.php?action=edit&#038;<strong>cat_ID=3</strong></p></blockquote>
<p>The ordering will be by date, newest first. (Don&#8217;t forget you can tweak the timestamp of a post if you really want to just to get the order exactly as you want it).</p>
<p>So create a couple of posts in this category and add some thumbnails to them &#8211; since our slideshow is going to be 300px by 160px, make sure they&#8217;re bigger than that. Then, in <strong>home.php</strong>, or <strong>index.php</strong>, where ever you want the slideshow to appear, add:</p>
<pre class="brush: php">
&lt;?php

$featured_category_id = 3;
$number_of_posts = 4;

$args = array(&#039;showposts&#039;=&gt;$number_of_posts, &#039;cat&#039;=&gt;$featured_category_id);

$slideshow_query = new WP_Query($args);

?&gt;
&lt;div id=&quot;slideshow&quot;&gt;
&lt;?php
// let&#039;s keep a record of the post IDs as we go, in case we want to omit these from other post loops/lists on the same page
$duplicates = array();

while ($slideshow_query-&gt;have_posts()) : $slideshow_query-&gt;the_post();

//add the ID to the duplicates array for future reference
$duplicates[] = $id;

//test to see whether there&#039;s a thumbnail associated with the post
if (has_post_thumbnail()) {
?&gt;
&lt;div class=&quot;post-thumbnail&quot;&gt;
&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot;&gt;
&lt;?php	the_post_thumbnail(&#039;slideshow-image&#039;); ?&gt;
&lt;/a&gt;
&lt;/div&gt;
&lt;?php	}
endwhile;
?&gt;
&lt;/div&gt;  &lt;!-- end of #slideshow --&gt;
</pre>
<p>Next, some javascript. We can use the excellent <a href="http://malsup.com/jquery/cycle/">jQuery Cycle Plugin</a> &#8211; as the package stands currently, we&#8217;ll use <strong>jquery.cycle.all.min.js</strong> &#8211; which allows all the possible transition effects etc. &#8211; in practice, you may well want to use the lighter versions&#8230;</p>
<p>* For a standard production site, always use <strong>min</strong> = minified,  rather than <strong>pack</strong> = packed &#8211; pack may be a smaller filesize, but it doesn&#8217;t run quicker&#8230;.</p>
<p>We need a very quick script to configure and activate the plugin &#8211; so create a new file, <strong>slideshow-activate.js</strong></p>
<pre class="brush: js">
jQuery(document).ready(function($){
$(&#039;#slideshow&#039;).cycle({
fx: &#039;fade&#039; // choose your transition type, ex: fade, scrollUp, shuffle, etc...
});
});
</pre>
<p>Later, there are lots of options here, transition speed, pausing etc. &#8211; consult the <a href="http://malsup.com/jquery/cycle/browser.html">plugin pages</a> for ideas.</p>
<p>We need to get our scripts on the WordPress page, and indicate that they depend on jQuery being loaded &#8211; making use of the WordPress functions <strong>wp_register_script</strong> and <strong>wp_enqueue_script</strong> &#8211; so in <strong>functions.php</strong></p>
<pre class="brush: php">

add_action(&#039;wp&#039;, &#039;js_head_load&#039;);

function js_head_load(){

if(is_admin()) return;  //so that we&#039;re not loading unecessary scripts in the admin

wp_register_script(&#039;cycle&#039;, get_bloginfo(&#039;template_directory&#039;)  . &#039;/scripts/jquery.cycle.all.min.js&#039;, array(&#039;jquery&#039;), &#039;1.0&#039;);

wp_enqueue_script(&#039;slideshow-activate&#039;,  get_bloginfo(&#039;template_directory&#039;)  . &#039;/scripts/slideshow-activate.js&#039;, array(&#039;jquery&#039;, &#039;cycle&#039;), &#039;1.0&#039;);

}
</pre>
<p>And then, don&#8217;t forget to put the 2 files into /scripts in your theme folder&#8230;</p>
<p>That should give you a working slideshow &#8211; ready to be styled with some CSS. Note that the way the Cycle plugin works is that it looks to rotate the immediate children of the div being called &#8211; here, they&#8217;re images, they could be eg. divs &#8211; so if you add a wrapper div(s) you may need to adjust slideshow-activate.js.</p>
<p>And if it&#8217;s not working, check first that the right scripts (jQuery, Cycle, slideshow-activate) are actually being loaded and in the right order, by looking at the page source &#8211; and check you&#8217;ve got thumbnails attached to the relevant posts&#8230;</p>
<p>You could go on to tidy this up &#8211; avoiding the hard-coded category id by having something in the theme options admin to change the id for example. Also, as said earlier, there&#8217;s a lot of scope in playing with the plugin parameters to get exactly the slideshow you want&#8230;</p>
<p>Lastly &#8211; the record of the duplicates we kept &#8211; the method for omitting them from subsequent Loops of posts is here: <a href="http://themocracy.com/2010/01/multiple-wordpress-queries-duplicates/">Multiple WordPress query duplicates</a></p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/jquery-slideshow-wordpress/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Using Google Code libraries with WordPress</title>
		<link>http://themocracy.com/2010/02/using-google-code-libraries-with-wordpress/</link>
		<comments>http://themocracy.com/2010/02/using-google-code-libraries-with-wordpress/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 15:54:40 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=224</guid>
		<description><![CDATA[By default, WordPress loads the version of jQuery that comes with the package. But there is an alternative way of doing it and that&#8217;s to use the AJAX Libraries API at Google Code &#8211; use their bandwidth, why not&#8230;
A few lines added to your functions.php in the theme you&#8217;re building and you&#8217;re ready to go.

 [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fusing-google-code-libraries-with-wordpress%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fusing-google-code-libraries-with-wordpress%2F" height="61" width="51" /></a></div><p><img class="alignright size-full wp-image-207" title="wordpress-250x250" src="http://themocracy.com/wp-content/uploads/2010/01/wordpress-250x250.png" alt="" width="192" height="192" /><strong>By default, WordPress loads the version of jQuery that comes with the package.</strong> But there is an alternative way of doing it and that&#8217;s to use the AJAX Libraries API at Google Code &#8211; use their bandwidth, why not&#8230;</p>
<p>A few lines added to your functions.php in the theme you&#8217;re building and you&#8217;re ready to go.<br />
<span id="more-224"></span><br />
<strong> wp_register_script()</strong> &#8211; the useful point is that you can use this function to access scripts hosted elsewhere&#8230;</p>
<p>Just add this code to your <strong>functions.php</strong> file:</p>
<pre class="brush: php">
add_action(&#039;template_redirect&#039;, &#039;js_head_load&#039;);

function js_head_load(){

if(is_admin()) return;

wp_deregister_script(&#039;jquery&#039;);
wp_register_script(&#039;jquery&#039;, &#039;http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js&#039;);
wp_enqueue_script(&#039;jquery&#039;);
// and then any other scripts to register and queue...
}
</pre>
<p>Notice the first line of the function ensures that the jQuery isn&#8217;t loaded on WP admin pages -<em> if a script isn&#8217;t needed, don&#8217;t load it on the page</em> &#8211; and in this case jQuery in noConflict mode  can cause the admin rich text editor and the widget drag and drop interface to go awry..</p>
<p><strong>The advantages</strong>:-<br />
You&#8217;ll be able to update the version your site is using quickly and easily, probably a good thing.</p>
<p>Google Code tends to have a policy of only including versions demonstrated to be stable, jQuery 1.2.4 and 1.2.5 didn&#8217;t make the grade</p>
<p>The user may already have it cached in their browser via some previously visited site instead of downloading from a location on your site (and if enough sites do it, the chances are that much greater that they will have a copy in the cache).</p>
<p>Not just jQuery &#8211; check out jQuery UI<br />
<a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js">http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js</a><br />
And MooTools, which seems seriously under-used in conjunction with WordPress<br />
<a href="http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js">http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js</a></p>
<p>Always grab the minified version.</p>
<p>And lastly, one disadvantage:- googleapis.com does go down very occasionally &#8211; but then again a site ought to function, more or less, without javaScript.</p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/using-google-code-libraries-with-wordpress/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>JQuery, Cufon and WordPress</title>
		<link>http://themocracy.com/2010/01/jquery-cufon-and-wordpress/</link>
		<comments>http://themocracy.com/2010/01/jquery-cufon-and-wordpress/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 13:48:58 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[cufon]]></category>
		<category><![CDATA[fonts]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=209</guid>
		<description><![CDATA[Just at the moment the best font replacement technique around is cufón – so how to get this technique into your WordPress theme design?]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F01%2Fjquery-cufon-and-wordpress%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F01%2Fjquery-cufon-and-wordpress%2F" height="61" width="51" /></a></div><p><img class="alignright size-thumbnail wp-image-207" title="wordpress-250x250" src="http://themocracy.com/wp-content/uploads/2010/01/wordpress-250x250-150x150.png" alt="" width="150" height="150" />Just at the moment the best font replacement technique around is <a href="http://wiki.github.com/sorccu/cufon/">cufón</a> &#8211; so how to get this technique into your WordPress theme design?</p>
<p>You&#8217;ll need 3 javascript files &#8211; best to put them in the theme directory under /scripts</p>
<p>1. The Cufon javascript<br />
2. The individual font javascript &#8211; downloaded from cufon &#8211; or use their excellent generator http://cufon.shoqolate.com/generate/  (not all fonts as .ttf will do the trick, there&#8217;s issues of licensing in terms of web embedding)<br />
3. A custom script, very simple, just to activate.<br />
<span id="more-209"></span><br />
The plan is to get the scripts loading in the WP header, and the best action hook for this is <strong>template_redirect</strong> &#8211; so, in <strong>functions.php</strong></p>
<pre class="brush: php">
add_action(&#039;template_redirect&#039;, &#039;them_js_head_load&#039;);

function them_js_head_load(){

define(TH_TEMPLATE_URL, get_bloginfo(&#039;template_url&#039;));

wp_register_script(&#039;cufon&#039;, TH_TEMPLATE_URL . &#039;/scripts/cufon-yui.js&#039;, array(&#039;jquery&#039;), &#039;1.0&#039;);
wp_register_script(&#039;my_font&#039;, TH_TEMPLATE_URL . &#039;/scripts/myfont.font.js&#039;, array(&#039;jquery&#039;), &#039;1.0&#039;);
wp_enqueue_script(&#039;fontsactivate&#039;, TH_TEMPLATE_URL . &#039;/scripts/fontsactivate.js&#039;, array(&#039;jquery&#039;, &#039;cufon&#039;, &#039;them_font&#039;), &#039;1.0&#039;);
}
</pre>
<p><strong>fontsactivate.js</strong> is as simple as you want to make it &#8211; just this, for example, will replace all post h2 headings on the page</p>
<pre class="brush: js">
Cufon.replace(&#039;.post h2&#039;);
</pre>
<p>Don&#8217;t imagine it&#8217;s a great idea to replace all the text on a page with a custom font, that&#8217;ll make the server chug a bit &#8211; stick with headings&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/01/jquery-cufon-and-wordpress/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>More WordPress and jQuery</title>
		<link>http://themocracy.com/2010/01/more-wordpress-and-jquery/</link>
		<comments>http://themocracy.com/2010/01/more-wordpress-and-jquery/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 13:15:57 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=195</guid>
		<description><![CDATA[To refine a previous post on WordPress and jQuery and the use of the wp_enqueue_script function, its paths and dependencies.
As a barebones example, this is how we do it when we we&#8217;re enqueueing &#8211; if that&#8217;s a word &#8211; the jQuery Cycle plugin, so that we can make a slideshow on the page.

The important point [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F01%2Fmore-wordpress-and-jquery%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F01%2Fmore-wordpress-and-jquery%2F" height="61" width="51" /></a></div><p>To refine a previous post on WordPress and jQuery and the use of the <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script">wp_enqueue_script</a> function, its paths and dependencies.</p>
<p>As a barebones example, this is how we do it when we we&#8217;re enqueueing &#8211; if that&#8217;s a word &#8211; the <a href="http://www.malsup.com/jquery/cycle/">jQuery Cycle plugin</a>, so that we can make a slideshow on the page.<br />
<span id="more-195"></span><br />
The important point is probably in the dependencies &#8211; firstly, the Cycle plugin depends on jQuery, so has to be loaded after &#8211; secondly, our custom script to run the whole process on depends on the jQuery Cycle plugin and therefore also on jQuery and is the last to load.</p>
<p>The custom script we&#8217;ve written is in <strong>them_directory/scripts/them.cycle.js</strong>  &#8211; something very simple, like this:-</p>
<pre class="brush: js">
jQuery(document).ready(function($) {

$(&#039;#images&#039;).cycle({
//some parameters
 });
});
</pre>
<p>(Don&#8217;t forget, the dollar $ object isn&#8217;t defined in WordPress jQuery (historical reasons) &#8211; hence the form of the first line) </p>
<p>This is client-display side javascript, as opposed to admin-side, (which tends to follow slightly different rules in the WordPress setup) and in this case, the action hook &#8216;template_redirect&#8217; is usually the time to do it.</p>
<p>To enqueue the jQuery library itself is simple &#8211; it&#8217;s already registered by default in WordPress, no need to specify other than the default path and version.</p>
<p>So in <strong>functions.php</strong> </p>
<pre class="brush: php">
add_action(&#039;template_redirect&#039;, &#039;them_js_head_load&#039;);

function them_js_head_load(){

	//register the plugin
	wp_enqueue_script(&#039;jquery-cycle&#039;, THEM_TEMPLATEURL.&#039;/scripts/jquery.cycle.lite.min.js&#039;, array(&#039;jquery&#039;), &#039;1.0&#039;);
	//register the custom script
	wp_enqueue_script(&#039;them-cycle&#039;, THEM_TEMPLATEURL.&#039;/scripts/them.cycle.js&#039;, array(&#039;jquery&#039;, &#039;jquery-cycle&#039;), &#039;1.0&#039;);

}
</pre>
<p>Note for convenience and efficiency, we&#8217;ve previously defined</p>
<pre class="brush: php">

define(THEM_TEMPLATEURL, get_bloginfo(&#039;template_directory&#039;));
</pre>
<p>And what you end up with in the page source should be something like this &#8211; javascripts loaded in the right place in the page head, up and running</p>
<p><strong>&lt;script type=&#8217;text/javascript&#8217; src=&#8217;http://localhost/test/wp-content/themes/this-theme/scripts/jquery.cycle.lite.min.js?ver=1.0&#8242;&gt;&lt;/script&gt;</strong></p>
<p><strong>&lt;script type=&#8217;text/javascript&#8217; src=&#8217;http://localhost/test/wp-content/themes/this-theme/scripts/them.cycle.js?ver=1.0&#8242;&gt;&lt;/script&gt;</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/01/more-wordpress-and-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using jQuery with WordPress</title>
		<link>http://themocracy.com/2009/04/using-jquery-with-wordpress/</link>
		<comments>http://themocracy.com/2009/04/using-jquery-with-wordpress/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 12:51:04 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://localhost/themocracy/?p=3</guid>
		<description><![CDATA[If you&#8217;re a theme developer, you&#8217;ll (perhaps) be looking at keeping up with the latest in javascript/AJAX and incorporating a few tweaks into your brand new theme &#8211; in some ways, it&#8217;s been made very easy for you (and in one or two ways it&#8217;s just a little tricky&#8230;)

So, assuming you have a basic knowledge [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2009%2F04%2Fusing-jquery-with-wordpress%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2009%2F04%2Fusing-jquery-with-wordpress%2F" height="61" width="51" /></a></div><p><img style="padding:2px;border:2px solid #ccc;margin:0 0 0 10px;" src="http://themocracy.com/wp-content/uploads/2009/04/mw022.png" alt="mw022" title="mw022" width="229" height="75" class="alignright size-full wp-image-6" /><strong>If you&#8217;re a theme developer, you&#8217;ll (perhaps) be looking at keeping up with the latest in javascript/AJAX and incorporating a few tweaks into your brand new theme</strong> &#8211; in some ways, it&#8217;s been made very easy for you (and in one or two ways it&#8217;s just a little tricky&#8230;)<br />
<span id="more-3"></span><br />
So, assuming you have a basic knowledge of PHP, theme design and javascript, here&#8217;s how it works:-</p>
<p><strong>Loading up jQuery</strong></p>
<p>WordPress arrives with jQuery already bundled, so this bit&#8217;s easy enough. But we need to get it loaded onto the page, which doesn&#8217;t happen automatically&#8230;</p>
<p>The plan here would be to get some nice tabbed divisions going, maybe in the sidebar, courtesy of jQuery.</p>
<pre class="brush: php">
&lt;?php
add_action(&#039;template_redirect&#039;, &#039;them_js_head_load&#039;);

function them_js_head_load(){

 // we don&#039;t need this on admin pages, so...
	if(is_admin()) return;

      wp_enqueue_script(&#039;tabber&#039;, get_bloginfo(&#039;template_directory&#039;) . &#039;/scripts/tabs.js&#039;, array(&#039;jquery&#039;, &#039;jquery-ui-core&#039;, &#039;jquery-ui-tabs&#039;), &#039;1.0&#039;);
}
 ?&gt;
</pre>
<p>In this code, we&#8217;ve enqueued a custom script <strong>tabs.js</strong>, that&#8217;s going to initiate the whole process &#8211; and we&#8217;ve also declared its dependencies &#8211; <strong>jquery</strong>, <strong>jquery-ui-core</strong>, <strong>jquery-ui-tabs</strong>, the user interface sublibraries, also bundled into WordPress as standard.</p>
<p>These are already registered, so only the handle is required, here: &#8216;jquery-ui-tabs&#8217;, etc. </p>
<p>The full list of bundled libraries is at: <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script">WordPress wp_enqueue_script</a>.</p>
<p><strong>Vital!</strong> &#8211; The snippets of jQuery code you&#8217;ll find while out and about on the net make extensive use of the shortcut $ to express the jQuery global object. This isn&#8217;t going to work in WordPress, so at all times we use  <strong>jQuery</strong>(document).ready(function($) &#8211; and then it will work&#8230; Once inside the function, we can use $ as a shortcut. </p>
<p>The reason for this slight complication is that Prototype and Scriptaculous libraries arrived first into WordPress and have got to hold on to using the $ shortcut. And don&#8217;t be tempted to dabble with <strong>jQuery.noConflict()</strong> here &#8211; you won&#8217;t get good results.</p>
<p>And from here, since you know what you want to put in your theme in terms of flashy javascript/AJAX add-ons, I&#8217;ll leave you to get on with thieving some snippets and getting them up and running&#8230;.</p>
<p><strong>* Update</strong> &#8211; some of this information is superseded by changes in the way WordPress handles the loading of javascript &#8211; there&#8217;s a follow-up here &#8211; <a href="http://themocracy.com/2010/01/more-wordpress-and-jquery/">More about WordPress and jQuery</a></p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2009/04/using-jquery-with-wordpress/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
	</channel>
</rss>
