<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Coen Jacobs / WordPress developer</title>
	
	<link>http://coenjacobs.net</link>
	<description />
	<lastBuildDate>Tue, 22 Jun 2010 14:11:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/CoenJacobsWordPressAddict" /><feedburner:info uri="coenjacobswordpressaddict" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>CoenJacobsWordPressAddict</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Getting back in WordPress blogging action</title>
		<link>http://feedproxy.google.com/~r/CoenJacobsWordPressAddict/~3/A2u-L9_NbiU/</link>
		<comments>http://coenjacobs.net/2010/06/wordpress-blogging-action/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 14:11:46 +0000</pubDate>
		<dc:creator>Coen Jacobs</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://coenjacobs.net/?p=1141</guid>
		<description><![CDATA[It&#8217;s been a while since my last post on this blog. Been pretty busy with lots of cool WordPress projects. I&#8217;m currently updating my portfolio so stay tuned! As you can see, I&#8217;ve updated this blog to WordPress 3.0 and &#8230; <a href="http://coenjacobs.net/2010/06/wordpress-blogging-action/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since my last post on this blog. Been pretty busy with lots of cool WordPress projects. I&#8217;m currently updating my <a href="http://coenjacobs.net/portfolio/">portfolio</a> so stay tuned!</p>
<p>As you can see, I&#8217;ve updated this blog to WordPress 3.0 and it&#8217;s new theme; TwentyTen. In the next few days, I&#8217;ll tweak it here and there to fit my needs even better but I&#8217;ve always liked the clean, yet stylish look of the new default WordPress theme. The history of this blog is packed into the <a href="http://coenjacobs.net/category/archived/">Archived</a> category, for future reference. New posts will appear in matching categories and tags.</p>
<p>Once this blog restart is complete, I will start updating my <a href="http://coenjacobs.net/wordpress-plugins/">WordPress plugins</a> (and the corresponding pages on this blog). Some of them are not 100% effective in WordPress 3.0, so there is some work to do!</p>
<p>For now; <a href="https://twitter.com/coenjacobs">follow me on Twitter</a> and stay tuned on the upcoming changes.</p>
]]></content:encoded>
			<wfw:commentRss>http://coenjacobs.net/2010/06/wordpress-blogging-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://coenjacobs.net/2010/06/wordpress-blogging-action/</feedburner:origLink></item>
		<item>
		<title>Speaking at WordPress meetup in Amersfoort</title>
		<link>http://feedproxy.google.com/~r/CoenJacobsWordPressAddict/~3/4JWzuA2wJA8/</link>
		<comments>http://coenjacobs.net/2010/04/dutch-wordpress-meetup-amersfoort-awesome/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 11:15:03 +0000</pubDate>
		<dc:creator>Coen Jacobs</dc:creator>
				<category><![CDATA[Archived]]></category>

		<guid isPermaLink="false">http://coenjacobs.net/?p=1050</guid>
		<description><![CDATA[Yesterday was the first WordPress meetup in Amersfoort. I was invited to host a presentation on WordPress plugin development and off course, I was pleased to do so. I met some great, inspiring people (Remkus de Vries and Jeroen van &#8230; <a href="http://coenjacobs.net/2010/04/dutch-wordpress-meetup-amersfoort-awesome/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Yesterday was the first WordPress meetup in Amersfoort. I was invited to host a presentation on WordPress plugin development and off course, I was pleased to do so.</p>
<p>I met some great, inspiring people (<a href="http://twitter.com/DeFries">Remkus de Vries</a> and <a href="http://twitter.com/neorey">Jeroen van Dijk</a>) and got the chance to finally meet <a href="http://twitter.com/Kajrietberg">Kaj Rietberg,</a> <a href="http://twitter.com/jeroendemiranda">Jeroen de Miranda</a> and <a href="http://twitter.com/KarinBron">Karin Bronwasser</a>, who I only talked to via Twitter. Unfortunately I&#8217;m pretty sure I missed my shot at talking to a few great people, but we&#8217;ll meet some other day I hope.</p>
<p>My presentation was a rather basic introduction to WordPress plugins, what&#8217;s the WordPress hooks system is about and how to build a (very basic) plugin on your own. The people attending my presentation are easily divided into two levels. There where people who are used to develop plugins and themes on their own, but also people who have never even thought of doing so.</p>
<p>But in the end, the presentation worked out great. It became a interactive session and lots of questions from the audience. I heard lots of people talking about trying to build a plugin on their own, so I guess my presentation was a success.</p>
<p>My presentation was in Dutch, here are the slides;</p>
<div id="__ss_3597457" style="width: 425px;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=wordpress-plugins-100330162316-phpapp01&amp;rel=0&amp;stripped_title=ontwikkeling-wordpress-plugins" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=wordpress-plugins-100330162316-phpapp01&amp;rel=0&amp;stripped_title=ontwikkeling-wordpress-plugins" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<h2>Special thanks!</h2>
<p>I&#8217;d like to thank <a href="http://twitter.com/Kajrietberg">Kaj Rietberg</a> and <a href="http://twitter.com/roytanck">Roy Tanck</a> for hosting the event and inviting me. The entire event was great, a enthusiastic audience, great presentations and a wonderful location; simply awesome!</p>
]]></content:encoded>
			<wfw:commentRss>http://coenjacobs.net/2010/04/dutch-wordpress-meetup-amersfoort-awesome/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://coenjacobs.net/2010/04/dutch-wordpress-meetup-amersfoort-awesome/</feedburner:origLink></item>
		<item>
		<title>Using conditional WordPress plugin file loading</title>
		<link>http://feedproxy.google.com/~r/CoenJacobsWordPressAddict/~3/4pY8zf-l4dM/</link>
		<comments>http://coenjacobs.net/2010/03/diving-deeper-conditional-wordpress-plugin-file-loading/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 16:05:24 +0000</pubDate>
		<dc:creator>Coen Jacobs</dc:creator>
				<category><![CDATA[Archived]]></category>

		<guid isPermaLink="false">http://coenjacobs.net/?p=1021</guid>
		<description><![CDATA[Back in 2009, I wrote a post on why you should use conditional file loading in a WordPress plugin. Now that we know why we should use it, let&#8217;s take a look at the massive amount of ways we can &#8230; <a href="http://coenjacobs.net/2010/03/diving-deeper-conditional-wordpress-plugin-file-loading/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Back in 2009, I wrote a post on <a href="http://coenjacobs.net/blog/wordpress-plugins-conditional-file-loading">why you should use conditional file loading</a> in a WordPress plugin. Now that we know why we should use it, let&#8217;s take a look at the massive amount of ways we can implement this into our plugins. Faster loading WordPress installations is our goal, by making our plugins just a little bit smarter.</p>
<p>Basic rule is: when we don&#8217;t need a file, don&#8217;t include it! When you write a plugin for the Dashboard, it is of no use loading the files used by the plugin at your homepage or at a single posts page. Let take a look at this example:</p>
<pre class="brush: php;">if(is_admin()) {
   include(&quot;admin_plugin.php&quot;);
}</pre>
<p>The imaginary plugin that we&#8217;re writing here, has some functionality in the WordPress Dashboard. We split up that functionality in a file called <em>plugin_admin.php</em> and we only include it inside the Dashboard. Whenever we are on a page outside of the Dashboard, the file will not be included, which will result in a faster loading page.</p>
<h2>Using other WordPress conditions</h2>
<p>Besides <em>is_admin()</em>, we have a few common conditions inside WordPress. With <em>is_single()</em> we check if the current page is a single post page and with <em>is_category()</em> we check for a category page. It would be cool if we could use these conditions inside our plugins to determine wether or not a file is needed.</p>
<p>But there is the catch. Conditions like <em>is_single() </em>and <em>is_category()</em> do not work inside a plugin because WordPress loads the plugins way before it knows what kind of page it is at. A great workaround is to hook your script to the <em>wp-hook</em>, so it will be executed right after the posts are loaded, so WordPress knows the type of the page.</p>
<p>A quick example to get you going. In this script, a function is added to the <em>wp-hook</em>, that will include a plugin file, only when we&#8217;re at a single post page:</p>
<pre class="brush: php;">add_action(&quot;wp&quot;, &quot;load_plugin&quot;);

function load_plugin() {
   if(is_single()) {
      include(&quot;single_plugin.php&quot;);
   }
}</pre>
<p>Using a load-function inside the <em>wp-hook</em>, we can use conditions like <em>is_single()</em> just like <em>is_admin()</em> inside a plugin. This way you can start preventing your plugins from loading files that WordPress does not need at certain pages.</p>
<p>You might need to restructure your plugin a bit to make it work this way. But when used effectively, it will make each and every WordPress installation a lot faster.</p>
]]></content:encoded>
			<wfw:commentRss>http://coenjacobs.net/2010/03/diving-deeper-conditional-wordpress-plugin-file-loading/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://coenjacobs.net/2010/03/diving-deeper-conditional-wordpress-plugin-file-loading/</feedburner:origLink></item>
		<item>
		<title>Display Twitter followers count in plain text</title>
		<link>http://feedproxy.google.com/~r/CoenJacobsWordPressAddict/~3/o1fWqOuCujk/</link>
		<comments>http://coenjacobs.net/2010/03/display-twitter-followers-count-plain-text/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 16:02:38 +0000</pubDate>
		<dc:creator>Coen Jacobs</dc:creator>
				<category><![CDATA[Archived]]></category>

		<guid isPermaLink="false">http://coenjacobs.net/?p=977</guid>
		<description><![CDATA[Although Twittercounter is a great service, the button you can display on your blog looks horrible. What we want is our number of followers on Twitter, in plain text, so we can style it the way we want. Thanks to &#8230; <a href="http://coenjacobs.net/2010/03/display-twitter-followers-count-plain-text/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Although Twittercounter is a great service, the button you can display on your blog looks horrible. What we want is our number of followers on Twitter, in plain text, so we can style it the way we want. Thanks to the Twitter API, it is very easy to achieve this.</p>
<p>There is very little code required to actually show the number of followers. But we don&#8217;t want to stress out the Twitter API, so we&#8217;re going to build some sort of caching into the script as well. The number of followers will only be updated once per hour.</p>
<p>In the function that we&#8217;re about to write, we use the Snoopy class to read into the file the Twitter API outputs. The Snoopy class comes with WordPress by default, so the only requirement you have left is a server with PHP 5.2 or up. To write our code as clean as possible, we will put the function inside <em>functions.php</em> of our theme.</p>
<h2>The function</h2>
<p>Let&#8217;s take a closer look at the function;</p>
<pre class="brush: php;">function get_twitter_followers($username)
{
require_once(ABSPATH . 'wp-includes/class-snoopy.php');
$twitter = get_option(&quot;twitterfollowers&quot;);
$api = &quot;http://twitter.com/statuses/user_timeline/&quot;.$username.&quot;.json?count=1&quot;;

if ($twitter['lastcheck'] &lt; ( mktime() - 60 ) )
{
$snoopy = new Snoopy;
$result = $snoopy-&gt;fetch($api);

if ($result)
{
$data = json_decode($snoopy-&gt;results,true);
$twitter['followers'] = $data[0]['user']['followers_count'];
update_option('twitterfollowers',$twitter);
}
}

return $twitter['followers'];
}</pre>
<p>What the function does, in short; it takes your username as a argument. If the last update from the Twitter API, is within the last 60 minutes, it reads the amount of followers from the local &#8216;cache&#8217;. When the last update was longer than 60 minutes ago,  it reads into the Twitter API using the Snoopy class to get the latest data. The data will be stored in the &#8216;cache&#8217; (after being decoded), and so is the timestamp to indicate the time of our last update. After that, the amount of followers is returned.</p>
<h2>Using the function</h2>
<p>To use this function, you simply call it and provide your username as a argument. For instance, when I want my amount followers to be returned, I call the function like this;</p>
<pre class="brush: php;">&lt;?php echo get_twitter_followers(&quot;coenjacobs&quot;); ?&gt;</pre>
<p>Off course, I can work this out a little bit more. In the next example, I add some text around the number of followers and I add a hyperlink to my profile at Twitter.</p>
<pre class="brush: php;">&lt;a href=&quot;http://twitter.com/coenjacobs&quot;&gt;
I have &lt;?php echo get_twitter_followers(&quot;coenjacobs&quot;) ?&gt; followers on Twitter
&lt;/a&gt;</pre>
<p>From here you can start styling the text. Add them in a paragraph, make the amount of followers bold, or apply a color (like I did in my sidebar) to the text. With your Twitter followers count in plain text, you have complete freedom on the styling.</p>
<p><em>Credits go to Joost de Valk, publishing his code to <a href="http://yoast.com/display-latest-tweet/">display your latest tweet</a> got me inspired and was a perfect example for this code snippet.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://coenjacobs.net/2010/03/display-twitter-followers-count-plain-text/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://coenjacobs.net/2010/03/display-twitter-followers-count-plain-text/</feedburner:origLink></item>
		<item>
		<title>Added some more business body to my blog</title>
		<link>http://feedproxy.google.com/~r/CoenJacobsWordPressAddict/~3/e-J-woEHf1o/</link>
		<comments>http://coenjacobs.net/2010/03/added-business-body/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 10:35:11 +0000</pubDate>
		<dc:creator>Coen Jacobs</dc:creator>
				<category><![CDATA[Archived]]></category>

		<guid isPermaLink="false">http://coenjacobs.net/?p=663</guid>
		<description><![CDATA[The past months I&#8217;ve been developing on WordPress projects for lots of clients and some very cool collaborations. Unfortunately, that lead to a lack of posts on this blog. But that&#8217;s exactly what&#8217;s going to change as of today, starting &#8230; <a href="http://coenjacobs.net/2010/03/added-business-body/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The past months I&#8217;ve been developing on WordPress projects for lots of clients and some very cool collaborations. Unfortunately, that lead to a lack of posts on this blog. But that&#8217;s exactly what&#8217;s going to change as of today, starting with some changes to this website and even more changes will be rolled out this week.</p>
<p>My blog was a place for me where I just published my articles on WordPress, nothing business related. But more and more people started to contact me for WordPress jobs after visiting my blog. That&#8217;s why I&#8217;ve added some more pages to give the business part of my site some more body, starting with a quick &#8216;<a href="http://coenjacobs.net/hire-me/">Hire Me</a>&#8216; page.</p>
<p>I&#8217;ve also added a <a href="http://coenjacobs.net/portfolio">portfolio</a>. Young business professionals like I claim to be, can&#8217;t deal without a decent portfolio nowadays. Please check out the projects I&#8217;ve worked on and <a href="http://coenjacobs.net/contact">drop me a line</a> if you have something to ask, suggest or simply have something else you want to tell me. Thanks for all the comments so far, I really appreciate it!</p>
]]></content:encoded>
			<wfw:commentRss>http://coenjacobs.net/2010/03/added-business-body/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://coenjacobs.net/2010/03/added-business-body/</feedburner:origLink></item>
		<item>
		<title>New WordPress plugin: Latest Update Date</title>
		<link>http://feedproxy.google.com/~r/CoenJacobsWordPressAddict/~3/Crhc9_Xzku4/</link>
		<comments>http://coenjacobs.net/2009/11/wordpress-plugin-latest-update-date/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 22:13:59 +0000</pubDate>
		<dc:creator>Coen Jacobs</dc:creator>
				<category><![CDATA[Archived]]></category>

		<guid isPermaLink="false">http://coenjacobs.net/?p=894</guid>
		<description><![CDATA[Every once in a while you come across a idea for a plugin that seems so obvious, yet far-fetched, that you can&#8217;t imagine that the plugin isn&#8217;t build already. That&#8217;s what happened when I got the idea for the Latest &#8230; <a href="http://coenjacobs.net/2009/11/wordpress-plugin-latest-update-date/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Every once in a while you come across a idea for a plugin that seems so obvious, yet far-fetched, that you can&#8217;t imagine that the plugin isn&#8217;t build already. That&#8217;s what happened when I got the idea for the <a href="http://coenjacobs.net/wordpress/plugins/latest-update-date">Latest Update Date WordPress plugin</a>.</p>
<p>A new client of me always had a date displayed in the footer of his website, before I converted it to WordPress. Off course, this can be updated manually, but my plugin does it automatically, out of the box. You can customize the styling of the text and the text itself, via the settings of the plugin.</p>
<p>In the near future, I&#8217;m planning on extending the functions of this plugin and make it able to display a single post or pages latest update date. I hope this plugin will help you cope with all the nostalgic feelings you might have to fight with once you start loving WordPress and stop building pages with static HTML content.</p>
]]></content:encoded>
			<wfw:commentRss>http://coenjacobs.net/2009/11/wordpress-plugin-latest-update-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://coenjacobs.net/2009/11/wordpress-plugin-latest-update-date/</feedburner:origLink></item>
		<item>
		<title>Create your very own WordPress plugin</title>
		<link>http://feedproxy.google.com/~r/CoenJacobsWordPressAddict/~3/jO0HpRf-GYM/</link>
		<comments>http://coenjacobs.net/2009/11/create-wordpress-plugin/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 00:34:48 +0000</pubDate>
		<dc:creator>Coen Jacobs</dc:creator>
				<category><![CDATA[Archived]]></category>

		<guid isPermaLink="false">http://coenjacobs.net/?p=844</guid>
		<description><![CDATA[A request that I&#8217;ve received more than once lately, is to make a rewrite on my &#8216;How to create a WordPress plugin&#8217; that I published on one of my previous blogs. Off course, I&#8217;m more than happy to publish it &#8230; <a href="http://coenjacobs.net/2009/11/create-wordpress-plugin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A request that I&#8217;ve received more than once lately, is to make a rewrite on my &#8216;How to create a WordPress plugin&#8217; that I published on one of my previous blogs. Off course, I&#8217;m more than happy to publish it here again, mostly because it is so easy to create your own plugins and you can start right now!</p>
<p>The official documentation on <a href="http://codex.wordpress.org/Writing_a_Plugin">Writing a WordPress Plugin</a> is great, but it lacks in a usable, clear example of how to write a plugin for WordPress.</p>
<p>All plugins have some required comment fields at the very top of the file. These comment fields give all the information a WordPress blog needs to identify and start using your very own plugin. Let&#8217;s take a look at it;</p>
<p style="font-family: monospace;">
<pre class="brush: php;">&lt;?php
/*
Plugin Name: Plugin name
Plugin URI: URL to the plugin page
Description: A description of what the plugin does
Version: Version number
Author: Your name, as the author of this plugin
Author URI: URL to your homepage
*/
?&gt;</pre>
<p>Now WordPress knows what our plugin is about, let&#8217;s add some functionality to it. In my previous example, the plugin was used to correct frequent misspellings to the name of our favorite blogging tool, let&#8217;s do that again.</p>
<h3>Let&#8217;s build your first WordPress plugin</h3>
<p>All plugins live (by default) in the <em>/wp-content/plugins/</em> directory. Create a file called <em>my-first-plugin.php</em> there and paste the comments we&#8217;ve just discussed into the file.</p>
<pre class="brush: php;">&lt;?php
/*
Plugin Name: My very first WordPress plugin
Plugin URI: http://coenjacobs.net/blog/create-wordpress-plugin/
Description: Corrects frequent misspellings in the word: WordPress
Version: 0.1
Author: Coen Jacobs
Author URI: http://coenjacobs.net
*/
?&gt;</pre>
<p>As you can see, I&#8217;ve added some real values to the comment fields. You can edit them and make it your own plugin by adding your own name and URL&#8217;s.</p>
<p>The function that we will use to correct these frequent misspellings is quite simple and uses the <a href="http://php.net/str_replace">PHP function str_replace()</a> to replace certain parts of a WordPress posts content. We will also use a array to select which misspellings we will correct with this plugin to make it really easy to add new frequent misspellings.</p>
<p>Let&#8217;s take a closer look at this function;</p>
<pre class="brush: php;">function correct_misspellings($text)
{
 $misspellings = array(
 &quot;wordpress&quot;,
 &quot;Wordpress&quot;,
 &quot;wordPress&quot;,
 );

 $text = str_replace($misspellings, 'WordPress', $text);

 return $text;
}</pre>
<p>That&#8217;s basically it. All this function does is take the provided variable <em>$text</em>, and have all occurrences of a string inside the array called <em>$misspellings</em> be replaced with the string &#8216;WordPress&#8217;. After that it returns the variable <em>$text</em>.</p>
<h3>Hook up our function!</h3>
<p>But how does WordPress know how and when to use this function? With WordPress hooks, we can tell WordPress when to use functions from our own plugins. The hook that we will use for this plugin is the_content, the hook that is used by WordPress to show the content of a post. When we run our function on that hook, it will be applied to all posts and that&#8217;s exactly what we want. Let&#8217;s hook this function up!</p>
<pre class="brush: php;">add_filter('the_content', 'correct_misspellings');</pre>
<p>This little line of code is all we need to make sure our plugins function will be used inside the <em>the_content</em> hook. Using a WordPress function <a href="http://codex.wordpress.org/Function_Reference/add_filter"><em>add_filter()</em></a> we add a new filter to the <em>the_content</em> hook that is provided as the second argument.</p>
<p>Now, the code of our very first plugin is complete;</p>
<pre class="brush: php;">&lt;?php
/*
Plugin Name: My very first WordPress plugin
Plugin URI: http://coenjacobs.net/blog/create-wordpress-plugin/
Description: Corrects frequent misspellings in the word: WordPress
Version: 0.1
Author: Coen Jacobs
Author URI: http://coenjacobs.net
*/

function correct_misspellings($text)
{
 $misspellings = array(
 &quot;wordpress&quot;,
 &quot;Wordpress&quot;,
 &quot;wordPress&quot;,
 );

 $text = str_replace($misspellings, 'WordPress', $text);

 return $text;
}

add_filter('the_content', 'correct_misspellings');

?&gt;</pre>
<p>When we save all this code in our <em>my-first-plugin.php</em> file and activate it through the WordPress backend, our plugin will start working immediately and start fixing those irritating misspellings in the name of our favorite blogging tool!</p>
<h3>Add some extra misspellings to the plugin</h3>
<p>Because we use a array filled with misspellings, we can easily add a new misspelling to be corrected by our plugin, just by adding a new string to the array. When we add a new line of one of these highlighted lines, we can add a new string that contains another misspelling and it will be corrected right away;</p>
<pre class="brush: php; highlight: [4,5,6];">function correct_misspellings($text)
{
 $misspellings = array(
 &quot;wordpress&quot;,
 &quot;Wordpress&quot;,
 &quot;wordPress&quot;,
 );

 $text = str_replace($misspellings, 'WordPress', $text);

 return $text;
}</pre>
<h3>Disclaimer</h3>
<p>Off course, this plugin isn&#8217;t really usable since it replaces all misspellings everywhere throughout the site, even at certain places where you don&#8217;t want it to. But it shows that creating a plugin isn&#8217;t that hard and can be done in just a matter of minutes.</p>
]]></content:encoded>
			<wfw:commentRss>http://coenjacobs.net/2009/11/create-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://coenjacobs.net/2009/11/create-wordpress-plugin/</feedburner:origLink></item>
		<item>
		<title>WordPress plugins: Use conditional file loading</title>
		<link>http://feedproxy.google.com/~r/CoenJacobsWordPressAddict/~3/GVczHgKiARI/</link>
		<comments>http://coenjacobs.net/2009/10/wordpress-plugins-conditional-file-loading/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 20:00:09 +0000</pubDate>
		<dc:creator>Coen Jacobs</dc:creator>
				<category><![CDATA[Archived]]></category>

		<guid isPermaLink="false">http://coenjacobs.net/?p=818</guid>
		<description><![CDATA[A post by Joost de Valk on Conditional Thickbox loading made me think on how this could be applied to a lot of plugins. For example, let&#8217;s take a look at Sociable. Sociable is the plugin we all know, that &#8230; <a href="http://coenjacobs.net/2009/10/wordpress-plugins-conditional-file-loading/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A post by Joost de Valk on <a href="http://yoast.com/conditional-thickbox-loading/">Conditional Thickbox loading</a> made me think on how this could be applied to a lot of plugins. For example, let&#8217;s take a look at Sociable.</p>
<p>Sociable is the plugin we all know, that shows those nice little chicklets to allow easy sharing of your articles via social networks and websites. Many people, including myself, aren&#8217;t showing these chicklets on their homepage or a static content page, but the stylesheet is loading! Why are we loading that stylesheet on those pages?</p>
<p>The function, including the hook, where Sociable loads its stylesheet is:</p>
<pre class="brush: php;">function sociable_css() {
 if (get_option('sociable_useiframe') == true) {
 global $sociablepluginpath;
 wp_enqueue_style('sociable-thickbox-css',$sociablepluginpath.'thickbox/thickbox.css');
 }
 if (get_option('sociable_usecss') == true) {
 global $sociablepluginpath;
 wp_enqueue_style('sociable-front-css',$sociablepluginpath.'sociable.css');
 }
}
add_action('wp_print_styles', 'sociable_css');</pre>
<p>This function is called at the <em>wp_print_styles</em> hook and will therefor be included in each and every WordPress page, even when Sociable isn&#8217;t going to be displayed on that page. When we combine the comparing of the Sociable conditionals to the conditionals of the current page, like Sociable does in the function <em>sociable_display_hook()</em>, we can check if there is a need to include the stylesheet or not.</p>
<p>I think comparing these two conditionals should be implemented in a new function since Sociable needs to check it twice (for a iframe/thickbox and a custom stylesheet), so there is no need for coding this loop twice.</p>
<p>Off course, the Sociable stylesheet (852 bytes) isn&#8217;t that big. But this technique is applicable on much more plugins than just Sociable.</p>
]]></content:encoded>
			<wfw:commentRss>http://coenjacobs.net/2009/10/wordpress-plugins-conditional-file-loading/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://coenjacobs.net/2009/10/wordpress-plugins-conditional-file-loading/</feedburner:origLink></item>
		<item>
		<title>Speedy development with WordPress Debug Theme</title>
		<link>http://feedproxy.google.com/~r/CoenJacobsWordPressAddict/~3/AXUsKnjQGFQ/</link>
		<comments>http://coenjacobs.net/2009/10/speed-development-wordpress-debug-theme/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 17:10:05 +0000</pubDate>
		<dc:creator>Coen Jacobs</dc:creator>
				<category><![CDATA[Archived]]></category>

		<guid isPermaLink="false">http://coenjacobs.net/?p=799</guid>
		<description><![CDATA[Have you ever come across a point where you notice there is something wrong with a WordPress install, but you just don&#8217;t know where to look? I know I have been there, and so is Joost de Valk, who published &#8230; <a href="http://coenjacobs.net/2009/10/speed-development-wordpress-debug-theme/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Have you ever come across a point where you notice there is something wrong with a WordPress install, but you just don&#8217;t know where to look? I know I have been there, and so is Joost de Valk, who published the <a href="http://yoast.com/wordpress-debug-theme/">WordPress Debug Theme</a> today.</p>
<p>The things that I really like about it are the variables that will be printed on a single post page, or single page. Just like Joost, I&#8217;ve been struggling while trying to get the right values out of variables, or simply have a little peek inside it to know which variable you are looking for. This theme makes it all a lot easier.</p>
<p>Just like someone posted in the comments, this theme will work great with the <a href="http://wordpress.org/extend/plugins/theme-tester/">Theme Tester plugin</a>. Joost is a real social developer, so please post some more comments on his blog when you find something that he might add to the WordPress Debug Theme.</p>
]]></content:encoded>
			<wfw:commentRss>http://coenjacobs.net/2009/10/speed-development-wordpress-debug-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://coenjacobs.net/2009/10/speed-development-wordpress-debug-theme/</feedburner:origLink></item>
		<item>
		<title>Buma crawlers surrender before they even started</title>
		<link>http://feedproxy.google.com/~r/CoenJacobsWordPressAddict/~3/7momiZn6XZI/</link>
		<comments>http://coenjacobs.net/2009/10/buma-crawlers-surrender-before-starting/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 16:55:57 +0000</pubDate>
		<dc:creator>Coen Jacobs</dc:creator>
				<category><![CDATA[Archived]]></category>

		<guid isPermaLink="false">http://coenjacobs.net/?p=775</guid>
		<description><![CDATA[In the past few days I have received more email, tweets and retweets on Twitter and phone calls than in the month of September in total. The reason is the launch of my Teezir blocking WordPress plugin. Once I launched &#8230; <a href="http://coenjacobs.net/2009/10/buma-crawlers-surrender-before-starting/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In the past few days I have received more email, tweets and retweets on Twitter and phone calls than in the month of September in total. The reason is the launch of my <a href="http://coenjacobs.net/blog/steps-blocking-buma-crawlers-wordpress">Teezir blocking WordPress plugin</a>. Once I launched that plugin, people have been massively downloading it, loving it and sharing it with other people.</p>
<p>But today, we can celebrate a little victory and I am quite happy to be able to say that I will discontinue this plugin. Buma/Stemra canceled their actions (<a href="http://www.bumastemra.nl/nl-NL/OverBumaStemra/Actueel/BS+komt+internetgebruikers+tegemoet.htm">read the announcement in Dutch</a>), so paying to embed videos for non-commercial purposes is no longer required. I will publish one more update on this plugin within a couple of days, which will display a message on your administration pages that will recommend you to uninstall this plugin, so it won&#8217;t bother you anymore.</p>
<p>Once there is some more action required in this case, I&#8217;ll let you guys know and I will continue developing a plugin to block the crawlers on our blogs. Thanks again for sharing it with the world, let&#8217;s celebrate our victory!</p>
]]></content:encoded>
			<wfw:commentRss>http://coenjacobs.net/2009/10/buma-crawlers-surrender-before-starting/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://coenjacobs.net/2009/10/buma-crawlers-surrender-before-starting/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.472 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-08-24 13:15:52 -->
