<?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>rtCafe &#187; snippets</title>
	<atom:link href="http://cafe.rtcamp.com/tag/snippets/feed/" rel="self" type="application/rss+xml" />
	<link>http://cafe.rtcamp.com</link>
	<description>rtCamp Cafe</description>
	<lastBuildDate>Mon, 14 May 2012 19:26:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>APPLYING SPAN TO THE FIRST LETTER OF EVERY WORD IN A SENTENCE</title>
		<link>http://cafe.rtcamp.com/2012/03/07/applying-span-to-the-first-letter-of-every-word-in-a-sentence/</link>
		<comments>http://cafe.rtcamp.com/2012/03/07/applying-span-to-the-first-letter-of-every-word-in-a-sentence/#comments</comments>
		<pubDate>Wed, 07 Mar 2012 10:59:55 +0000</pubDate>
		<dc:creator>Abhimanyu</dc:creator>
				<category><![CDATA[post]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[snippet code]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[wordpress snippets]]></category>

		<guid isPermaLink="false">http://cafe.rtcamp.com/2012/03/07/applying-span-to-the-first-letter-of-every-word-in-a-sentence/</guid>
		<description><![CDATA[Check out @ http://pastebin.com/ij6xeeGT For javascript substring reference: http://www.w3schools.com/jsref/jsref_substring.asp]]></description>
			<content:encoded><![CDATA[<p>Check out @ <a href="http://pastebin.com/ij6xeeGT" rel="nofollow">http://pastebin.com/ij6xeeGT</a></p>
<p>For javascript substring reference: <a href="http://www.w3schools.com/jsref/jsref_substring.asp" rel="nofollow">http://www.w3schools.com/jsref/jsref_substring.asp</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cafe.rtcamp.com/2012/03/07/applying-span-to-the-first-letter-of-every-word-in-a-sentence/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>101 Useful WordPress Snippets</title>
		<link>http://cafe.rtcamp.com/2012/02/20/101-useful-wordpress-snippets/</link>
		<comments>http://cafe.rtcamp.com/2012/02/20/101-useful-wordpress-snippets/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 14:08:57 +0000</pubDate>
		<dc:creator>Abhimanyu</dc:creator>
				<category><![CDATA[post]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[wordpress snippets]]></category>

		<guid isPermaLink="false">http://cafe.rtcamp.com/2012/02/20/101-useful-wordpress-snippets/</guid>
		<description><![CDATA[Check @ http://www.wpmods.com/101-useful-wordpress-snippets/]]></description>
			<content:encoded><![CDATA[<p>Check @ <a href="http://www.wpmods.com/101-useful-wordpress-snippets/" rel="nofollow">http://www.wpmods.com/101-useful-wordpress-snippets/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cafe.rtcamp.com/2012/02/20/101-useful-wordpress-snippets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress snippets and hacks</title>
		<link>http://cafe.rtcamp.com/2011/04/29/wordpress-snippet-and-hacks/</link>
		<comments>http://cafe.rtcamp.com/2011/04/29/wordpress-snippet-and-hacks/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 05:55:49 +0000</pubDate>
		<dc:creator>umesh.nevase@rtcamp.com</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://cafe.rtcamp.com/?p=483</guid>
		<description><![CDATA[Here are some wordpress snippet and hacks which are very useful for admin side. wordpress code snippet]]></description>
			<content:encoded><![CDATA[<p>Here are some wordpress snippet and hacks which are very useful for admin side.</p>
<p><a href="http://speckyboy.com/2011/04/27/20-snippets-and-hacks-to-make-wordpress-user-friendly-for-your-clients/">wordpress code snippet</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cafe.rtcamp.com/2011/04/29/wordpress-snippet-and-hacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP vars in javascript &#8211; the right way for wordpress</title>
		<link>http://cafe.rtcamp.com/2010/08/07/php-vars-in-javascript-the-right-way-for-wordpress/</link>
		<comments>http://cafe.rtcamp.com/2010/08/07/php-vars-in-javascript-the-right-way-for-wordpress/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 07:07:54 +0000</pubDate>
		<dc:creator>pragatisureka</dc:creator>
				<category><![CDATA[post]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://cafe.rtcamp.com/2010/08/07/php-vars-in-javascript-the-right-way-for-wordpress/</guid>
		<description><![CDATA[Very often in coding for wordpress I want to use some php vars in javascript (saved options, userinfo, etc) for that I end up 1) Naming my js file as &#8220;filename.js.php&#8221; now it becomes a php(js) file the only problem is for this file wordpress environment is not loaded so I load wordpress environment using [...]]]></description>
			<content:encoded><![CDATA[<p>Very often in coding for wordpress I want to use some php vars in javascript (saved options, userinfo, etc) for that I end up<br />
1) Naming my js file as &#8220;filename.js.php&#8221; now it becomes a php(js) file the only problem is for this file wordpress environment is not loaded so I load wordpress environment using &#8220;include &#8216;/path/to/wp-load.php&#8217;&#8221;. While some may think this is ok, so what we if have to load wordpress for this file, is makes my work easy, but then again we have to switch between php code block and javascript block.<br />
2) Embedding javascript in the body section of the the code where i need to use some php variable in javascript. While this might be the easiest way it makes code debugging and maintaining a very tedious task.</p>
<p>Now for the solution, wordpress provides a function &#8220;wp_localize_script&#8221; that is supposed to be used in conjunction with wp_enqueue_script() function. Heres the <a href="http://www.prelovac.com/vladimir/best-practice-for-adding-javascript-code-to-wordpress-plugin">link</a> to read more..</p>
<p>Another option is putting the following code in head section of the wordpress using wp_print_script/admin_print_script<br />
<code><br />
&lt;script type="text/javascript"&gt;<br />
// &lt;![CDATA[<br />
var someSettings = {<br />
'nonce': '&lt;?php echo wp_create_nonce('nonce-string'); ?&gt;',<br />
'ajax_url': '&lt;?php echo admin_url('admin-ajax.php); ?&gt;'<br />
};<br />
// ]]&gt;<br />
&lt;/script&gt;<br />
</code><br />
[Actually this is what wordpress does with wp_localize_script <img src='http://cafe.rtcamp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  . This is usefull when creating iframes]</p>
<p>now these values can be used in your javascript code like so<br />
<code><br />
var nonce = someSettings.nonce;<br />
var ajax_url = someSettings.ajax_url;<br />
</code></p>
<p>Happy coding&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://cafe.rtcamp.com/2010/08/07/php-vars-in-javascript-the-right-way-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Heres how to decode php encoded html str&#8230;</title>
		<link>http://cafe.rtcamp.com/2010/08/06/heres-how-to-decode-php-encoded-html-str/</link>
		<comments>http://cafe.rtcamp.com/2010/08/06/heres-how-to-decode-php-encoded-html-str/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 13:58:54 +0000</pubDate>
		<dc:creator>pragatisureka</dc:creator>
				<category><![CDATA[link]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http://cafe.rtcamp.com/2010/08/06/heres-how-to-decode-php-encoded-html-str/</guid>
		<description><![CDATA[Heres how to decode php encoded html string in javascript without actually using any function. for jQuery : var decoded_string = jQuery(&#8220;&#60;div /&#62;&#8221;).html(encoded_string).text(); TADA&#8230; thats it.]]></description>
			<content:encoded><![CDATA[<p>Heres how to decode php encoded html string in javascript without actually using any function.<br />
for jQuery :<br />
var decoded_string = jQuery(&#8220;&lt;div /&gt;&#8221;).html(encoded_string).text();</p>
<p>TADA&#8230; thats it.</p>
]]></content:encoded>
			<wfw:commentRss>http://cafe.rtcamp.com/2010/08/06/heres-how-to-decode-php-encoded-html-str/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS-Tricks Snippets Feed</title>
		<link>http://cafe.rtcamp.com/2010/08/06/css-tricks-snippets-feed/</link>
		<comments>http://cafe.rtcamp.com/2010/08/06/css-tricks-snippets-feed/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 10:55:22 +0000</pubDate>
		<dc:creator>Rahul Bansal</dc:creator>
				<category><![CDATA[post]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http://cafe.rtcamp.com/2010/08/06/css-tricks-snippets-feed/</guid>
		<description><![CDATA[Most of u might be following CSS-Tricks but u can also check this code-snippets feed http://feeds.feedburner.com/CSS-TricksSnippets Its very useful. You can see same section on web here http://css-tricks.com/snippets/]]></description>
			<content:encoded><![CDATA[<p>Most of u might be following CSS-Tricks<br />
but u can also check this code-snippets feed</p>
<p><a href="http://feeds.feedburner.com/CSS-TricksSnippets" rel="nofollow">http://feeds.feedburner.com/CSS-TricksSnippets</a></p>
<p>Its very useful.</p>
<p>You can see same section on web here</p>
<p><a href="http://css-tricks.com/snippets/" rel="nofollow">http://css-tricks.com/snippets/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cafe.rtcamp.com/2010/08/06/css-tricks-snippets-feed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

