<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Javascript and WordPress &#8211; The Definitive Guide</title>
	<atom:link href="http://matty.co.za/2010/03/enqueue-javascript-in-wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://matty.co.za/2010/03/enqueue-javascript-in-wordpress/</link>
	<description>Web developer, WordPress enthusiast, avid musician, music lover and blogger</description>
	<lastBuildDate>Tue, 07 Feb 2012 09:37:32 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Matty</title>
		<link>http://matty.co.za/2010/03/enqueue-javascript-in-wordpress/comment-page-1/#comment-3753</link>
		<dc:creator>Matty</dc:creator>
		<pubDate>Tue, 07 Feb 2012 09:37:32 +0000</pubDate>
		<guid isPermaLink="false">http://matty.co.za/?p=905#comment-3753</guid>
		<description>No problem, Elizabeth. I&#039;m glad this tutorial helped. :)</description>
		<content:encoded><![CDATA[<p>No problem, Elizabeth. I&#8217;m glad this tutorial helped. <img src='http://matty.co.za/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elizabeth</title>
		<link>http://matty.co.za/2010/03/enqueue-javascript-in-wordpress/comment-page-1/#comment-3750</link>
		<dc:creator>Elizabeth</dc:creator>
		<pubDate>Sat, 04 Feb 2012 04:30:57 +0000</pubDate>
		<guid isPermaLink="false">http://matty.co.za/?p=905#comment-3750</guid>
		<description>Very Well Done!  This is always the kind of thing that stumps me.  I moved from non-Wordpress to Wordpress and things just weren&#039;t working right.  I was able to get my function file setup and you kept me from pulling all of my hair out - hooray!  Thanks so much for the step by step!</description>
		<content:encoded><![CDATA[<p>Very Well Done!  This is always the kind of thing that stumps me.  I moved from non-Wordpress to WordPress and things just weren&#8217;t working right.  I was able to get my function file setup and you kept me from pulling all of my hair out &#8211; hooray!  Thanks so much for the step by step!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matty</title>
		<link>http://matty.co.za/2010/03/enqueue-javascript-in-wordpress/comment-page-1/#comment-3607</link>
		<dc:creator>Matty</dc:creator>
		<pubDate>Thu, 26 Aug 2010 08:33:51 +0000</pubDate>
		<guid isPermaLink="false">http://matty.co.za/?p=905#comment-3607</guid>
		<description>Hi Ed,
As per our correspondence, after looking through the code provided, I believe this to bea case of either the file not being pointed to correctly (ie: the path to the JavaScript file is incorrect) or a JavaScript conflict situation (the script provided looks to rely on the Prototype framework, which would need to be enqueued as well).

I would recommend getting a single script to enqueue correctly and, from there, enqueuing one script at a time in order to isolate the JavaScript conflict.

All the best,
Matty.</description>
		<content:encoded><![CDATA[<p>Hi Ed,<br />
As per our correspondence, after looking through the code provided, I believe this to bea case of either the file not being pointed to correctly (ie: the path to the JavaScript file is incorrect) or a JavaScript conflict situation (the script provided looks to rely on the Prototype framework, which would need to be enqueued as well).</p>
<p>I would recommend getting a single script to enqueue correctly and, from there, enqueuing one script at a time in order to isolate the JavaScript conflict.</p>
<p>All the best,<br />
Matty.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ed</title>
		<link>http://matty.co.za/2010/03/enqueue-javascript-in-wordpress/comment-page-1/#comment-3605</link>
		<dc:creator>Ed</dc:creator>
		<pubDate>Fri, 13 Aug 2010 02:40:10 +0000</pubDate>
		<guid isPermaLink="false">http://matty.co.za/?p=905#comment-3605</guid>
		<description>I am having difficulty with this and hoping someone can answer. How do I enqueue a script without a version #? Even if I leave it off, WordPress automatically adds ?ver=3.0 to it... and with the version # on the URL, the script will not load.
Any help would be appreciated.</description>
		<content:encoded><![CDATA[<p>I am having difficulty with this and hoping someone can answer. How do I enqueue a script without a version #? Even if I leave it off, WordPress automatically adds ?ver=3.0 to it&#8230; and with the version # on the URL, the script will not load.<br />
Any help would be appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matty</title>
		<link>http://matty.co.za/2010/03/enqueue-javascript-in-wordpress/comment-page-1/#comment-3604</link>
		<dc:creator>Matty</dc:creator>
		<pubDate>Wed, 11 Aug 2010 12:46:13 +0000</pubDate>
		<guid isPermaLink="false">http://matty.co.za/?p=905#comment-3604</guid>
		<description>Hi Wagner,
Thanks for checking in. :)

Regarding your query, I have a few ideas:

1. Your code to create the slider itself needs to be in a JavaScript file, that would also need to be enqueued. I&#039;d recommend creating a generic functions.js file, stored in your &quot;scripts&quot; folder, containing the code to setup the Coda slider. You would then need to add another enqueue below the line entitled &quot;coda-slider&quot;, to enqueue your setup script for the slider.

2. Do you have &quot;TEMPLATE_URL&quot; defined? If not, add this to your functions.php file (preferably at the top):

&lt;code&gt;define( &#039;TEMPLATE_URL&#039;, trailingslashit( get_stylesheet_directory_uri() ) );&lt;/code&gt;

This sets TEMPLATE_URL equal to your theme&#039;s folder and enables the correct direct link to each JavaScript file.

3. Change the action from running on &lt;code&gt;init()&lt;/code&gt; to &lt;code&gt;wp_head()&lt;/code&gt;. I have found this to work better and have amended the blog post to reflect this.

I hope this helps, Wagner. Please let me know if you require any further assistance with this. :)

Cheers,
Matt.</description>
		<content:encoded><![CDATA[<p>Hi Wagner,<br />
Thanks for checking in. <img src='http://matty.co.za/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Regarding your query, I have a few ideas:</p>
<p>1. Your code to create the slider itself needs to be in a JavaScript file, that would also need to be enqueued. I&#8217;d recommend creating a generic functions.js file, stored in your &#8220;scripts&#8221; folder, containing the code to setup the Coda slider. You would then need to add another enqueue below the line entitled &#8220;coda-slider&#8221;, to enqueue your setup script for the slider.</p>
<p>2. Do you have &#8220;TEMPLATE_URL&#8221; defined? If not, add this to your functions.php file (preferably at the top):</p>
<p><code>define( 'TEMPLATE_URL', trailingslashit( get_stylesheet_directory_uri() ) );</code></p>
<p>This sets TEMPLATE_URL equal to your theme&#8217;s folder and enables the correct direct link to each JavaScript file.</p>
<p>3. Change the action from running on <code>init()</code> to <code>wp_head()</code>. I have found this to work better and have amended the blog post to reflect this.</p>
<p>I hope this helps, Wagner. Please let me know if you require any further assistance with this. <img src='http://matty.co.za/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Cheers,<br />
Matt.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marc Perel</title>
		<link>http://matty.co.za/2010/03/enqueue-javascript-in-wordpress/comment-page-1/#comment-3603</link>
		<dc:creator>Marc Perel</dc:creator>
		<pubDate>Wed, 11 Aug 2010 12:43:14 +0000</pubDate>
		<guid isPermaLink="false">http://matty.co.za/?p=905#comment-3603</guid>
		<description>@Wagner - Hey mate, I know this is late, but here it goes anyway... I went through this one with our themes, with this technique it&#039;s best to use jQuery instead of $ so instead of saying:

$(&quot;selector&quot;) 

Use

jQuery(&quot;selector&quot;)

Or you could also say jQuery().ready(function($) {};  if you want to keep using your $ signs...

Cheers</description>
		<content:encoded><![CDATA[<p>@Wagner &#8211; Hey mate, I know this is late, but here it goes anyway&#8230; I went through this one with our themes, with this technique it&#8217;s best to use jQuery instead of $ so instead of saying:</p>
<p>$(&#8220;selector&#8221;) </p>
<p>Use</p>
<p>jQuery(&#8220;selector&#8221;)</p>
<p>Or you could also say jQuery().ready(function($) {};  if you want to keep using your $ signs&#8230;</p>
<p>Cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wagner Matos</title>
		<link>http://matty.co.za/2010/03/enqueue-javascript-in-wordpress/comment-page-1/#comment-3569</link>
		<dc:creator>Wagner Matos</dc:creator>
		<pubDate>Fri, 09 Jul 2010 12:20:17 +0000</pubDate>
		<guid isPermaLink="false">http://matty.co.za/?p=905#comment-3569</guid>
		<description>Hi Matt,

Wonder if you could help... I&#039;ve tried your technique with the Coda-Slider. I&#039;ve implemented it in my template file using this:

&lt;script type=&quot;text/javascript&quot; src=&quot;/scripts/jquery-1.3.2.min.js&quot;&gt;
		&lt;script type=&quot;text/javascript&quot; src=&quot;/scripts/jquery.easing.1.3.js&quot;&gt;
		&lt;script type=&quot;text/javascript&quot; src=&quot;/scripts/jquery.coda-slider-2.0.js&quot;&gt;
		
            $().ready(function() {
                $(&#039;#coda-slider-1&#039;).codaSlider();
                $(&#039;#coda-slider-2&#039;).codaSlider({
                    dynamicArrows: false,
					dynamicTabs: false,
                    autoSlide: true,
                    autoSlideInterval: 4000,
                    autoSlideStopWhenClicked: true
                });
                $(&#039;#coda-slider-3&#039;).codaSlider();
                $(&#039;#coda-slider-4&#039;).codaSlider();
				$(&#039;#coda-slider-5&#039;).codaSlider({
					dynamicArrows: false,
					dynamicTabs: false
				});
				$(&#039;#coda-slider-6&#039;).codaSlider({
                	crossLinking: false,
					firstPanelToLoad: 3
				});
				$(&#039;#coda-slider-7&#039;).codaSlider({
					autoHeightEaseDuration: 300,
					autoHeightEaseFunction: &quot;easeInOutExpo&quot;,
					slideEaseDuration: 300,
					slideEaseFunction: &quot;easeInOutExpo&quot;
				});
				$(&#039;#coda-slider-8&#039;).codaSlider({
					autoHeightEaseDuration: 2500,
					autoHeightEaseFunction: &quot;easeInOutElastic&quot;,
					slideEaseDuration: 2500,
					slideEaseFunction: &quot;easeInOutElastic&quot;
				});
            	$(&#039;#coda-slider-9&#039;).codaSlider({
					dynamicArrows: false
				});
            });
         

And works fine. However, that&#039;s not the proper way to do it, so using your tutorial I wrote this code:

function wm_enqueue_theme_js () {
wp_enqueue_script(&#039;easing&#039;, TEMPLATE_URL . &#039;scripts/jquery.easing.1.3.js&#039;, array(&#039;jquery&#039;), &#039;1.0&#039;, false);
wp_enqueue_script(&#039;coda-slider&#039;, TEMPLATE_URL . &#039;scripts/jquery.coda-slider-2.0.js&#039;, array(&#039;jquery&#039;, &#039;easing&#039;), &#039;1.0&#039;, false);
} // End wm_enqueue_theme_js()

add_action(&#039;init&#039;, &#039;wm_enqueue_theme_js&#039;);

And added into my functions file. But it doesn&#039;t work! Any ideas of why? Thanks!</description>
		<content:encoded><![CDATA[<p>Hi Matt,</p>
<p>Wonder if you could help&#8230; I&#8217;ve tried your technique with the Coda-Slider. I&#8217;ve implemented it in my template file using this:</p>
<p>&lt;script type=&quot;text/javascript&quot; src=&quot;/scripts/jquery-1.3.2.min.js&#8221;&gt;<br />
		&lt;script type=&quot;text/javascript&quot; src=&quot;/scripts/jquery.easing.1.3.js&#8221;&gt;<br />
		&lt;script type=&quot;text/javascript&quot; src=&quot;/scripts/jquery.coda-slider-2.0.js&#8221;&gt;</p>
<p>            $().ready(function() {<br />
                $(&#8216;#coda-slider-1&#8242;).codaSlider();<br />
                $(&#8216;#coda-slider-2&#8242;).codaSlider({<br />
                    dynamicArrows: false,<br />
					dynamicTabs: false,<br />
                    autoSlide: true,<br />
                    autoSlideInterval: 4000,<br />
                    autoSlideStopWhenClicked: true<br />
                });<br />
                $(&#8216;#coda-slider-3&#8242;).codaSlider();<br />
                $(&#8216;#coda-slider-4&#8242;).codaSlider();<br />
				$(&#8216;#coda-slider-5&#8242;).codaSlider({<br />
					dynamicArrows: false,<br />
					dynamicTabs: false<br />
				});<br />
				$(&#8216;#coda-slider-6&#8242;).codaSlider({<br />
                	crossLinking: false,<br />
					firstPanelToLoad: 3<br />
				});<br />
				$(&#8216;#coda-slider-7&#8242;).codaSlider({<br />
					autoHeightEaseDuration: 300,<br />
					autoHeightEaseFunction: &#8220;easeInOutExpo&#8221;,<br />
					slideEaseDuration: 300,<br />
					slideEaseFunction: &#8220;easeInOutExpo&#8221;<br />
				});<br />
				$(&#8216;#coda-slider-8&#8242;).codaSlider({<br />
					autoHeightEaseDuration: 2500,<br />
					autoHeightEaseFunction: &#8220;easeInOutElastic&#8221;,<br />
					slideEaseDuration: 2500,<br />
					slideEaseFunction: &#8220;easeInOutElastic&#8221;<br />
				});<br />
            	$(&#8216;#coda-slider-9&#8242;).codaSlider({<br />
					dynamicArrows: false<br />
				});<br />
            });</p>
<p>And works fine. However, that&#8217;s not the proper way to do it, so using your tutorial I wrote this code:</p>
<p>function wm_enqueue_theme_js () {<br />
wp_enqueue_script(&#8216;easing&#8217;, TEMPLATE_URL . &#8216;scripts/jquery.easing.1.3.js&#8217;, array(&#8216;jquery&#8217;), &#8217;1.0&#8242;, false);<br />
wp_enqueue_script(&#8216;coda-slider&#8217;, TEMPLATE_URL . &#8216;scripts/jquery.coda-slider-2.0.js&#8217;, array(&#8216;jquery&#8217;, &#8216;easing&#8217;), &#8217;1.0&#8242;, false);<br />
} // End wm_enqueue_theme_js()</p>
<p>add_action(&#8216;init&#8217;, &#8216;wm_enqueue_theme_js&#8217;);</p>
<p>And added into my functions file. But it doesn&#8217;t work! Any ideas of why? Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matty</title>
		<link>http://matty.co.za/2010/03/enqueue-javascript-in-wordpress/comment-page-1/#comment-3479</link>
		<dc:creator>Matty</dc:creator>
		<pubDate>Thu, 25 Mar 2010 18:09:35 +0000</pubDate>
		<guid isPermaLink="false">http://matty.co.za/?p=905#comment-3479</guid>
		<description>Thanks. :)

Yeah, I do wrap my code snippets in CODE tags. I&#039;ll be highlighting them more in my redesign (coming soon) as well as looking into adding a syntax highlighter to make longer snippets easier to read.

Thanks again for your comment. :)</description>
		<content:encoded><![CDATA[<p>Thanks. <img src='http://matty.co.za/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Yeah, I do wrap my code snippets in CODE tags. I&#8217;ll be highlighting them more in my redesign (coming soon) as well as looking into adding a syntax highlighter to make longer snippets easier to read.</p>
<p>Thanks again for your comment. <img src='http://matty.co.za/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JavaScriptBank.com</title>
		<link>http://matty.co.za/2010/03/enqueue-javascript-in-wordpress/comment-page-1/#comment-3472</link>
		<dc:creator>JavaScriptBank.com</dc:creator>
		<pubDate>Tue, 23 Mar 2010 04:27:30 +0000</pubDate>
		<guid isPermaLink="false">http://matty.co.za/?p=905#comment-3472</guid>
		<description>very cool &amp; good tips, thank you very much for sharing.

but I think you should wrap your code into PRE or CODE tags?</description>
		<content:encoded><![CDATA[<p>very cool &amp; good tips, thank you very much for sharing.</p>
<p>but I think you should wrap your code into PRE or CODE tags?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matty</title>
		<link>http://matty.co.za/2010/03/enqueue-javascript-in-wordpress/comment-page-1/#comment-3463</link>
		<dc:creator>Matty</dc:creator>
		<pubDate>Tue, 16 Mar 2010 16:11:03 +0000</pubDate>
		<guid isPermaLink="false">http://matty.co.za/?p=905#comment-3463</guid>
		<description>Hi Gary,
Thanks so much for your kind words. I really appreciate it and am glad you found this post to be useful.

I&#039;m currently in the process of redesigning and recoding this blog. I will be adding features to enhance the code visibility and will look into adding a syntax highlighter. Thanks for the note. :)

Cheers,
Matty.</description>
		<content:encoded><![CDATA[<p>Hi Gary,<br />
Thanks so much for your kind words. I really appreciate it and am glad you found this post to be useful.</p>
<p>I&#8217;m currently in the process of redesigning and recoding this blog. I will be adding features to enhance the code visibility and will look into adding a syntax highlighter. Thanks for the note. <img src='http://matty.co.za/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Cheers,<br />
Matty.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Object Caching 356/366 objects using disk: basic

Served from: matty.co.za @ 2012-02-09 12:13:37 -->
