<?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>MoonKat Creations &#187; WordPress</title>
	<atom:link href="http://www.moonkatcreations.com/category/web-design/wordpress-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.moonkatcreations.com</link>
	<description>Not just another WordPress blog about web design</description>
	<lastBuildDate>Thu, 02 Sep 2010 17:32:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Adding jQuery to WordPress</title>
		<link>http://www.moonkatcreations.com/web-design/jquery/adding-jquery-to-wordpress/</link>
		<comments>http://www.moonkatcreations.com/web-design/jquery/adding-jquery-to-wordpress/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 00:11:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.moonkatcreations.com/?p=217</guid>
		<description><![CDATA[You could add your custom jQuery to Wordpress by using the script tag in your head template, but this method can cause conflicts with JavaScript in other Wordpress plugins.

Instead, use the wp_enqueue_script, the Wordpress-friendly method. You will need direct access to your Wordpress files.]]></description>
			<content:encoded><![CDATA[<p>You <em>could</em> add your custom jQuery to WordPress by using the script tag in your head template, but this method can cause conflicts with JavaScript in other WordPress plugins.</p>
<p>Instead, use the wp_enqueue_script, the WordPress-friendly method. You will need direct access to your WordPress files.</p>
<ol>
<li>Go into wp-content/plugins, and create a new javascript folder.</li>
<li>In this folder, place your .js file.</li>
<li>In header.php, before &lt;?php wp_head(); ?&gt;, place this:</li>
</ol>
<pre>&lt;?php
wp_enqueue_script('custom',
'/' . PLUGINDIR . '/javascript/yourscript.js',
array('jquery'),
'1.0' );
?&gt;</pre>
<p>That&#8217;s it. You don&#8217;t need to do anything additional to include the jQuery library, since it&#8217;s specified as in the array as a file that your script is dependent upon. In place of &#8216;jquery&#8217; you can use Scriptaculous, jQuery UI Tabs, or any number of libraries that are built into WordPress.</p>
<p>Those libraries, as well as additional information about the wp_enqueue_script can be found at <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script">codex.wordpress.org/Function_Reference/wp_enqueue_script</a>.</p>
<p>According to the codex, this script can&#8217;t be placed above &lt;?php wp_head(); ?&gt;, but I&#8217;ve found that on the contrary, it works ONLY when placed above it. This same page of the codex also says that &#8216;$&#8217; can be used instead of &#8216;jQuery&#8217; inside the document ready function, which is also currently not accurate.</p>
<p>In other words, where you would use &#8216;$&#8217; in your jQuery function, you MUST use &#8216;jQuery&#8217; for every instance, not just in the document ready function. Feel free to test this with your own script; I&#8217;m not sure why the Codex is wrong on these points.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moonkatcreations.com/web-design/jquery/adding-jquery-to-wordpress/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
