<?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>Naatan.com - Opensource Web Developer &#187; Wordpress Snippets</title>
	<atom:link href="http://naatan.com/category/snippets/wordpress-snippets/feed/" rel="self" type="application/rss+xml" />
	<link>http://naatan.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 23 Jul 2009 02:35:05 +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>Multiple spaces in Wordpress posts</title>
		<link>http://naatan.com/2008/11/multiple-spaces-in-wordpress-posts/</link>
		<comments>http://naatan.com/2008/11/multiple-spaces-in-wordpress-posts/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 13:20:00 +0000</pubDate>
		<dc:creator>Naatan</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Snippets]]></category>

		<guid isPermaLink="false">http://naatan.com/?p=76</guid>
		<description><![CDATA[If you&#8217;ve ever tried posting source code on your blog you probably have noticed that Wordpress has the annoying habbit of stripping out multiple spaces out of your post, god knows why.
Anyway, I was not the only one getting annoyed by this and so a plugin already exists to fix this behaviour, only this plugin [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><a href="http://naatan.com/wp-content/uploads/2008/11/nbsp.png"><img class="alignright size-full wp-image-78" title="nbsp" src="http://naatan.com/wp-content/uploads/2008/11/nbsp.png" alt="nbsp" width="150" height="75" /></a>If you&#8217;ve ever tried posting source code on your blog you probably have noticed that Wordpress has the <em>annoying habbit</em> of stripping out multiple spaces out of your post, god knows why.</p>
<p style="text-align: justify;">Anyway, I was not the only one getting annoyed by this and so <a href="http://englishmike.net/other-plugins/tinymceentities-plugin/" target="_blank">a plugin already exists</a> to fix this behaviour, only this plugin will make ugly nbsp&#8217;s appear in your post when editing it, to fix this, simply replace line 39 with the following</p>
<pre title="code" class="php">
$text = str_replace('&amp;amp;nbsp;','&amp;nbsp;',$text); // Allow NBSP's
</pre>
<p>That&#8217;s it, you should now be able to use multiple spaces in your posts.</p>
]]></content:encoded>
			<wfw:commentRss>http://naatan.com/2008/11/multiple-spaces-in-wordpress-posts/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Adding Smilies to your Wordpress Plugins</title>
		<link>http://naatan.com/2008/11/adding-smilies-to-your-plugins/</link>
		<comments>http://naatan.com/2008/11/adding-smilies-to-your-plugins/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 02:11:00 +0000</pubDate>
		<dc:creator>Naatan</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Snippets]]></category>

		<guid isPermaLink="false">http://naatan.com/?p=65</guid>
		<description><![CDATA[Whilst monitoring the #wordpress irc channel on irc.freenode.net I came across a question by &#8220;erchik&#8221; asking how to add smilies to his widgets.
After some researching I found this to be quite simple, of course there is unfortunately no global way of doing this for all your widgets at once, since every widget has it&#8217;s own [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-69" title="wordpress-logo" src="http://naatan.com/wp-content/uploads/2008/11/wordpress-logo-300x282.png" alt="wordpress-logo" width="118" height="111" />Whilst monitoring the <a href="irc://irc.freenode.org/#wordpress">#wordpress</a> irc channel on <a href="irc://irc.freenode.org">irc.freenode.net</a> I came across a question by &#8220;<em>erchik</em>&#8221; asking how to add smilies to his widgets.</p>
<p>After some researching I found this to be quite simple, of course there is unfortunately no global way of doing this for all your widgets at once, since every widget has it&#8217;s own backend, but it&#8217;s quite easy to achieve and is not limited to widgets, you can use it in plugins and templates all the same.</p>
<p>Simply add the following lines to your code right before you are outputting the string that you want to contain smilies</p>
<pre title="code" class="php">

global $wp_smiliessearch, $wp_smiliesreplace;
$content = preg_replace($wp_smiliessearch, $wp_smiliesreplace, $content);
</pre>
<p>Replace <em>$content</em> with the name of your string containing the content.<br />
<span id="more-65"></span></p>
<p>If for whatever reason this does not work for you, try adding the following line before the 2 lines given:</p>
<pre title="code" class="php">

smilies_init();
</pre>
<p>This will populate the smilie replacement vars.</p>
<p>And that&#8217;s it, in this case I was applying it to a widget called <a href="http://www.piepalace.ca/blog/projects/miniposts" target="_blank">MiniPosts (version 0.6.6)</a>, you can get the patch file for it <a href="http://naatan.com/files/patch/miniposts2.php.patch">here</a> (right click &gt; save as).</p>
<p>To apply the patch on a linux box simply execute the following command</p>
<p><pre class="terminal"><br />
patch -i /path/to/miniposts2.php.patch /path/to/miniposts2.php<br />
</pre></p>
<p>Basically what you need to do is add the following 2 lines at line 424 of miniposts2.php</p>
<pre title="code" class="php">

global $wp_smiliessearch, $wp_smiliesreplace;
$text = preg_replace($wp_smiliessearch, $wp_smiliesreplace, $text);
</pre>
<p>I&#8217;d drop the modified miniposts2.php file here but I don&#8217;t feel comfortable posting / hosting somebody elses work, I&#8217;ll contact the author though.</p>
]]></content:encoded>
			<wfw:commentRss>http://naatan.com/2008/11/adding-smilies-to-your-plugins/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
