<?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: How To: Load Javascript With Your WordPress Plugin</title>
	<atom:link href="http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/feed/" rel="self" type="application/rss+xml" />
	<link>http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/?source=rss</link>
	<description>A bit of my personal life, mainly focused on my kids. A bit of code, mainly focused on Wordpress and PHP. Overall, bits of nothing in particular.</description>
	<lastBuildDate>Thu, 18 Mar 2010 03:25:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: mwaterous</title>
		<link>http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/comment-page-1/#comment-96530</link>
		<dc:creator>mwaterous</dc:creator>
		<pubDate>Sun, 01 Nov 2009 03:11:58 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=784#comment-96530</guid>
		<description>I tried searching google, poking through dashboard.php and even crossed my fingers and checked out what wp_add_dashboard_widget returned as a value, but to no avail.

I have a plugin that I originally had done this with, until I added a dashboard widget. I&#039;m curious if there&#039;s a hook I could use to load the styles on the dashboard, so I don&#039;t have to load them globally?

The closest thing I turned up on google, was ironically this post.</description>
		<content:encoded><![CDATA[<p>I tried searching google, poking through dashboard.php and even crossed my fingers and checked out what wp_add_dashboard_widget returned as a value, but to no avail.</p>
<p>I have a plugin that I originally had done this with, until I added a dashboard widget. I&#8217;m curious if there&#8217;s a hook I could use to load the styles on the dashboard, so I don&#8217;t have to load them globally?</p>
<p>The closest thing I turned up on google, was ironically this post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bobsoap</title>
		<link>http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/comment-page-1/#comment-96521</link>
		<dc:creator>bobsoap</dc:creator>
		<pubDate>Sat, 31 Oct 2009 05:15:30 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=784#comment-96521</guid>
		<description>Thanks Ozh for yet another eye-opening post right when it was needed. Keep it up.</description>
		<content:encoded><![CDATA[<p>Thanks Ozh for yet another eye-opening post right when it was needed. Keep it up.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Henry</title>
		<link>http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/comment-page-1/#comment-96450</link>
		<dc:creator>Henry</dc:creator>
		<pubDate>Mon, 26 Oct 2009 23:26:59 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=784#comment-96450</guid>
		<description>@Ozh: Oh really?! That&#039;s good news :-) Thanks for the hint!</description>
		<content:encoded><![CDATA[<p>@Ozh: Oh really?! That&#8217;s good news :-) Thanks for the hint!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ozh</title>
		<link>http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/comment-page-1/#comment-96433</link>
		<dc:creator>Ozh</dc:creator>
		<pubDate>Sun, 25 Oct 2009 12:10:48 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=784#comment-96433</guid>
		<description>Henry » You can totally have several $(document).ready() and they won&#039;t override themselves.</description>
		<content:encoded><![CDATA[<p>Henry » You can totally have several $(document).ready() and they won&#8217;t override themselves.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Henry</title>
		<link>http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/comment-page-1/#comment-96426</link>
		<dc:creator>Henry</dc:creator>
		<pubDate>Sat, 24 Oct 2009 12:26:10 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=784#comment-96426</guid>
		<description>Hello,

first thanks for the post, it already helped a lot. Now I know how to properly load an external javascript file into the header of a specific page.

Though a new problem arose from that: I defined some functions in my external javascript file, which need to be called when the DOM is ready. Usually jQuery provides the &quot;ready&quot; function for that purpose. But I don&#039;t want to put the &quot;jQuery(document).ready(function() { });&quot; code directly in the head, because this might cause trouble with other plugins (overriding). Any suggestions how to deal with that problem?

Thanks for reading and thinking about it...

Cheers
Henry</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>first thanks for the post, it already helped a lot. Now I know how to properly load an external javascript file into the header of a specific page.</p>
<p>Though a new problem arose from that: I defined some functions in my external javascript file, which need to be called when the DOM is ready. Usually jQuery provides the &#8220;ready&#8221; function for that purpose. But I don&#8217;t want to put the &#8220;jQuery(document).ready(function() { });&#8221; code directly in the head, because this might cause trouble with other plugins (overriding). Any suggestions how to deal with that problem?</p>
<p>Thanks for reading and thinking about it&#8230;</p>
<p>Cheers<br />
Henry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen R</title>
		<link>http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/comment-page-1/#comment-95824</link>
		<dc:creator>Stephen R</dc:creator>
		<pubDate>Sat, 12 Sep 2009 20:39:01 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=784#comment-95824</guid>
		<description>So, what&#039;s the difference between:

[php]admin_print_scripts-(page_hook)[/php]

and 

[php]admin_head-(page_hook)[/php]

?</description>
		<content:encoded><![CDATA[<p>So, what's the difference between:</p>
<div class="igBar"><span id="lphp-1"><a href="#" onclick="javascript:showPlainTxt('php-1'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-1">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">admin_print_scripts-<span style="color:#006600; font-weight:bold;">&#40;</span>page_hook<span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>and </p>
<div class="igBar"><span id="lphp-2"><a href="#" onclick="javascript:showPlainTxt('php-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-2">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">admin_head-<span style="color:#006600; font-weight:bold;">&#40;</span>page_hook<span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rune Jensen</title>
		<link>http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/comment-page-1/#comment-95010</link>
		<dc:creator>Rune Jensen</dc:creator>
		<pubDate>Thu, 13 Aug 2009 11:02:19 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=784#comment-95010</guid>
		<description>Cool post! It really helped me develop the admin panel and chart features for &lt;a href=&quot;http://wordpress.org/extend/plugins/spamtask/&quot; rel=&quot;nofollow&quot;&gt;SpamTask&lt;/a&gt;. :)
Thanks!</description>
		<content:encoded><![CDATA[<p>Cool post! It really helped me develop the admin panel and chart features for <a href="http://wordpress.org/extend/plugins/spamtask/" rel="nofollow">SpamTask</a>. :)<br />
Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Come integrare JQuery nel vostro tema Wordpress &#124; Pecciola</title>
		<link>http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/comment-page-1/#comment-94739</link>
		<dc:creator>Come integrare JQuery nel vostro tema Wordpress &#124; Pecciola</dc:creator>
		<pubDate>Thu, 30 Jul 2009 04:33:32 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=784#comment-94739</guid>
		<description>[...] in pratica. Vediamo il modo più semplice e veloce per farlo. In primis, vi ricordo che esiste un modo consigliato per caricare javascript sulle pagine di Wordpress ed è la funzione wp_enqueue_script che, come vedete da link, richiede un [...]</description>
		<content:encoded><![CDATA[<p>[...] in pratica. Vediamo il modo più semplice e veloce per farlo. In primis, vi ricordo che esiste un modo consigliato per caricare javascript sulle pagine di Wordpress ed è la funzione wp_enqueue_script che, come vedete da link, richiede un [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Artem Russakovskii</title>
		<link>http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/comment-page-1/#comment-94142</link>
		<dc:creator>Artem Russakovskii</dc:creator>
		<pubDate>Tue, 07 Jul 2009 00:36:33 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=784#comment-94142</guid>
		<description>Just to clarify my last comment, as it may not have been clear enough.
If you want to use this method for CSS, you HAVE TO USE the admin_print_styles-$menu_page hook, not the admin_print_scripts-$menu_page!! Now that I have your attention, go read the previous comment.</description>
		<content:encoded><![CDATA[<p>Just to clarify my last comment, as it may not have been clear enough.<br />
If you want to use this method for CSS, you HAVE TO USE the admin_print_styles-$menu_page hook, not the admin_print_scripts-$menu_page!! Now that I have your attention, go read the previous comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Artem Russakovskii</title>
		<link>http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/comment-page-1/#comment-93632</link>
		<dc:creator>Artem Russakovskii</dc:creator>
		<pubDate>Wed, 17 Jun 2009 17:30:14 +0000</pubDate>
		<guid isPermaLink="false">http://planetozh.com/blog/?p=784#comment-93632</guid>
		<description>Excellent post, Ozh, as always - exactly what I needed.

I have a comment regarding loading CSS files in a similar fashion. I have a function enqueue_scripts() that does the CSS and JS enqueuing using wp_enqueue_script() and wp_enqueue_style().
After I applied [php]
add_action(&quot;admin_print_scripts-$menu_page&quot;, array($this, &#039;enqueue_meta&#039;));
[/php]
I only saw JS showing up in the head. After a bit of mucking around, I found that there&#039;s a admin_print_styles- hook that does exactly that. It&#039;s obvious but a bit of a tricky one to notice right away. 

So, really, they can both call the same function, like so:
[php]
add_action(&quot;admin_print_scripts-$menu_page&quot;, array($this, &#039;enqueue_meta&#039;));
add_action(&quot;admin_print_styles-$menu_page&quot;, array($this, &#039;enqueue_meta&#039;));
[/php]

Hope it helps someone.</description>
		<content:encoded><![CDATA[<p>Excellent post, Ozh, as always - exactly what I needed.</p>
<p>I have a comment regarding loading CSS files in a similar fashion. I have a function enqueue_scripts() that does the CSS and JS enqueuing using wp_enqueue_script() and wp_enqueue_style().<br />
After I applied
<div class="igBar"><span id="lphp-3"><a href="#" onclick="javascript:showPlainTxt('php-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-3">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">add_action<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"admin_print_scripts-$menu_page"</span>, <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>, <span style="color:#FF0000;">'enqueue_meta'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
I only saw JS showing up in the head. After a bit of mucking around, I found that there's a admin_print_styles- hook that does exactly that. It's obvious but a bit of a tricky one to notice right away. </p>
<p>So, really, they can both call the same function, like so:</p>
<div class="igBar"><span id="lphp-4"><a href="#" onclick="javascript:showPlainTxt('php-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-4">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">add_action<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"admin_print_scripts-$menu_page"</span>, <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>, <span style="color:#FF0000;">'enqueue_meta'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">add_action<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"admin_print_styles-$menu_page"</span>, <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>, <span style="color:#FF0000;">'enqueue_meta'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Hope it helps someone.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
