<?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>/home/shakir &#187; php</title>
	<atom:link href="http://www.mohdshakir.net/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mohdshakir.net</link>
	<description>My Piece Of The Web</description>
	<lastBuildDate>Fri, 16 Jul 2010 15:45:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to create a WordPress plugin</title>
		<link>http://www.mohdshakir.net/2007/12/17/how-to-create-a-wordpress-plugin</link>
		<comments>http://www.mohdshakir.net/2007/12/17/how-to-create-a-wordpress-plugin#comments</comments>
		<pubDate>Mon, 17 Dec 2007 13:02:00 +0000</pubDate>
		<dc:creator>shakir</dc:creator>
				<category><![CDATA[Information Insemination]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.mohdshakir.net/2007/12/17/how-to-create-a-wordpress-plugin</guid>
		<description><![CDATA[I&#8217;m into writing a plugin for WordPress, and so let me just share here how easy it is to actually create one. For an example, we&#8217;re going to write a plugin that will insert a Google Adsense to our blog post. From our WordPress installation directory, create a file named google_adds.php in the wp-contents/plugins/ directory [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m into writing a plugin for WordPress, and so let me just share here how easy it is to actually create one.</p>
<p>For an example, we&#8217;re going to write a plugin that will insert a Google Adsense to our blog post.</p>
<p>From our WordPress installation directory, create a file named <em>google_adds.php</em> in the <em>wp-contents/plugins/</em> directory and add these lines;&nbsp;</p>
<pre>
&lt;?php
/*
Plugin Name: Google Adsense
Version: 0.1
Plugin URI: www.mohdshakir.net
Description: This plugin will display Google Adsense in every post
Author: Mohd Shakir bin Zakaria
Author URI: www.mohdshakir.net
*/
?&gt;
</pre>
<p>To see what it does, login to your WordPress admin panel and go to the Plugins section.</p>
<p><a href="http://www.mohdshakir.net/wp-content/uploads/image/200712/wordpress-plugins.png"><img src="http://www.mohdshakir.net/wp-content/uploads/image/200712/wordpress-plugins-mini.png" alt="" /></a></p>
<p>As what can be seen from the screenshot, the information of the plugins there were taken from the comments on our plugin code. We can now activate the plugin, but for now our plugin doesn&#8217;t really do anything useful.</p>
<p>Let&#8217;s go back to our PHP code, and add some lines to be as the following</p>
<pre>
&lt;?php
/*
Plugin Name: Google Adsense
Version: 0.1
Plugin URI: http://www.mohdshakir.net
Description: This plugin will display Google Adsense in every post
Author: Mohd Shakir bin Zakaria
Author URI: http://www.mohdshakir.net
*/

function adsense($text){

        $adsense_code = &lt;&lt;&lt;EOT
# Add your own Adsense code here
EOT;

        return $adsense_code . &quot;&lt;br \&gt;&quot;  .$text;
}

/*
  Add filter is a built in WordPress function, and the_content
  is a WordPress variable of a single post content.
*/
add_filter('the_content', 'adsense');

?&gt;
</pre>
<p>Let&#8217;s see if it works</p>
<p><a href="http://www.mohdshakir.net/wp-content/uploads/image/200712/wordpress-frontpage.png"><img src="http://www.mohdshakir.net/wp-content/uploads/image/200712/wordpress-frontpage-mini.png" alt="" /></a></p>
<p>That&#8217;s it, our first fully functioning Google Adsense plugin <img src='http://www.mohdshakir.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mohdshakir.net/2007/12/17/how-to-create-a-wordpress-plugin/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
