<?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>WordPress Web Hosting &#187; wordpress plugins structure</title>
	<atom:link href="http://www.shrewdies.net/blog/wordpress-plugins-structure/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shrewdies.net</link>
	<description>Business Web Hosting For Shrewdies Not Dummies</description>
	<lastBuildDate>Thu, 01 Jul 2010 06:41:39 +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>WordPress Plugins &#8211; Developer&#8217;s Dream</title>
		<link>http://www.shrewdies.net/498/wordpress-plugins-developers-dream/</link>
		<comments>http://www.shrewdies.net/498/wordpress-plugins-developers-dream/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 13:55:22 +0000</pubDate>
		<dc:creator>Keith from shrewdies</dc:creator>
				<category><![CDATA[Function]]></category>
		<category><![CDATA[shrewdBar]]></category>
		<category><![CDATA[shrewdChat]]></category>
		<category><![CDATA[wordpress plugin]]></category>
		<category><![CDATA[wordpress plugins structure]]></category>
		<category><![CDATA[WordPress Pods CMS]]></category>

		<guid isPermaLink="false">http://www.shrewdies.net/?p=498</guid>
		<description><![CDATA[I searched for WordPress Plugins that would help me apply structure to my own efforts. A scary journey, but now the nightmare is over. Now I can dream happily of a bright WordPress development future. But, there is no time to dream. Not even time to hack together a pretty picture to decorate this article. [...]]]></description>
			<content:encoded><![CDATA[<div class="kctIntro">I searched for WordPress Plugins that would help me apply structure to my own efforts.</p>
<p>A scary journey, but now the <a href="http://www.shrewdies.net/279/wordpress-plugins-beginners-nightmare/" title="Elusive WordPress Plugins Structure">nightmare</a> is over.</p>
<p>Now I can dream happily of a bright WordPress development future.</p></div>
<p>But, there is no time to dream. Not even time to hack together a pretty picture to decorate this article. I&#8217;m fired up for developing, but there is just enough time to let you know what the plan is.</p>
<p>When I finally decided on the SCB framework, I sat down to plan how to integrate my menu system, a hack of DashBar, into that structure. It looked like a project that might also suit <a href="http://www.shrewdies.net/466/pods-wordpress-plugin/" title="WordPress Data Management">Pods</a>, as I would need somewhere to store menu item links.</p>
<p>What&#8217;s the first thing I notice in SCB? Routines to handle WordPress options and table data. But can&#8217;t I just use Pods for that?</p>
<p>Yes, I can!</p>
<p><span id="more-498"></span>To cut a long story, I knocked together a fully customizable menu system in record time. It is not finished yet, but I&#8217;m so pleased with the results, and ease of development, that I decided to feature how I have developed it over the next few days.</p>
<p>As of today, it is lurking near the foot of the page, with a list based cascading menu that doesn&#8217;t quite work (Note to CSS developers &#8211; beware inherited settings that you have assumed will not be used elsewhere). It would have been finished a day earlier, but I was trying to adapt a definition list dropdown menu. All was going really well, until I found that it is impossible to make that kind of CSS structure perform the variable width trick.</p>
<p>Variable width is really a must, as the <a href="http://www.shrewdies.net/shrewdbar/" title="WordPress Menu &#038; Login Combination Bar">shrewdBar</a> doubles as a login form. So I will get on with re-wrapping the menu in the same way as the DashBar-based version, then I&#8217;ll go through the development stages so you can see just how easy it is to get Pods to do most of your development work.</p>
<p>Once that is finished, I will convert my other plugin work-in-progress) to Pods, and also use it for a full-blown web based application that I have had in the pipeline for well over a year. <a href="http://www.shrewdies.net/shrewdbar/" title="Simple WordPress Forum">shrewdChat discussion package</a> soon, then The Big One, just as soon as I get shrewdBar &#038; shrewdChat to good, usable stage.</p>
<p><!--more--><div style="margin-left:-1em;"><table><tr><td><script type="text/javascript"><!--
google_ad_client = "pub-7512621270035949";
/* shrewdies 300x250, created 22/12/09 */
google_ad_slot = "4026195862";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></td><td>
<script type="text/javascript"><!--
ch_client = "GoutPal";
ch_type = "mpu";
ch_width = 300;
ch_height = 250;
ch_color_bg = "ffffff";
ch_color_border = "ffffff";
ch_color_title = "00009e";
ch_color_site_link = "00009e";
ch_non_contextual = 4;
ch_vertical ="premium";
ch_sid = "ShrewdiesReward";
ch_alternate_ad_url = "http://www.shrewdies.net/ad.html";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript">
</script></td></tr></table></div> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.shrewdies.net/498/wordpress-plugins-developers-dream/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Plugins &#8211; Beginners Nightmare</title>
		<link>http://www.shrewdies.net/279/wordpress-plugins-beginners-nightmare/</link>
		<comments>http://www.shrewdies.net/279/wordpress-plugins-beginners-nightmare/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 18:12:12 +0000</pubDate>
		<dc:creator>Keith from shrewdies</dc:creator>
				<category><![CDATA[Function]]></category>
		<category><![CDATA[wordpress plugin]]></category>
		<category><![CDATA[wordpress plugins structure]]></category>

		<guid isPermaLink="false">http://www.shrewdies.net/?p=279</guid>
		<description><![CDATA[WordPress plugins are vital for efficiently functioning websites. Given their importance, I would expect much more effort going into helping new plugin developers get to grips with plugin structure.&#160; The WordPress development team resist adding features to the core if they are not universal requirements and can be dealt with by plugins. This is a [...]]]></description>
			<content:encoded><![CDATA[<div class="kctIntro">
<p>WordPress plugins are vital for efficiently functioning websites.</p>
<p><div id="attachment_280" class="wp-caption alignright" style="width: 245px"><a href="http://www.shrewdies.net/wp-content/uploads/wordpress-plugins-structure-nightmare.gif"><img src="http://www.shrewdies.net/wp-content/uploads/wordpress-plugins-structure-nightmare-235x300.gif" alt="WordPress Plugins Structure Nightmare" title="WordPress Plugins Structure Nightmare" width="235" height="300" class="size-medium wp-image-280" /></a><p class="wp-caption-text">WordPress Plugins Structure Nightmare</p></div>
<p>Given their importance, I would expect much more effort going into helping new plugin developers get to grips with plugin structure.<br />&nbsp;</p>
</div>
<p>The WordPress development team resist adding features to the core if they are not universal requirements and can be dealt with by plugins. This is a good thing, and they have recently announced plans to develop &#8220;canonical&#8221; (i.e. official) plugins to &#8220;address the most popular functionality requests with superlative execution&#8221;<a href="#ref1">[1]</a>.</p>
<p>Significantly, these will be &#8220;the best possible example of coding standards&#8221;<a href="#ref1">[1]</a>. But just what are these coding standards that are deemed so important?</p>
<p>The first thing I want to do when I write a plugin is adopt a structure that:
<ul>
<li>Is the most efficient in terms of performance (i.e. no redundant code, especially admin code loaded for all users)</li>
<li>Uses core WordPress functions and methods instead of home-grown alternatives.</li>
<li>Uses latest functionality and best practice, avoiding deprecated functions and methods.</li>
<li>Is familiar to the majority of plugin developers.</li>
</ul>
<p>It&#8217;s the last point that induces the biggest nightmare. Official coding standards<a href="#ref2">[2]</a> focus heavily on inline documentation and formatting<a href="#ref3">[3]</a><a href="#ref4">[4]</a>. This is all very well, but we need good examples that clearly show best practice in how to organize code in modules. Which bits are best in separate modules, and how should they be organized in sub-folders?</p>
<p>It speaks volumes to me that <span id="more-279"></span>the biggest plugin competition judging can only produce a list of 10 things to avoid<a href="#ref5">[5]</a>. Developers would avoid these mistakes if they had decent examples to follow. Instead, we are all wallowing in our own vats of spaghetti code, producing our own coding structures (or lack of structure), and never achieving anything that is instantly accessible to other developers.</p>
<p>Don&#8217;t get me wrong, the 10 mistakes to avoid are welcome, and the judging comments on which they are based are invaluable. But the advice is difficult to take on board when you are wondering how to best structure an object oriented plugin that will not break as soon as you upload it. There are plenty of other good coding tips<a href="#ref6">[6]</a>, including good admin page tips<a href="#ref7">[7]</a>. These are all very welcome, but I&#8217;m still struggling with where to put them!</p>
<p>I have tried one or two &#8220;plugin templates&#8221;, but they are all out of date, and not easily developed. The best I have come across (from my limited perspective) has almost no documentation other than a pointer to an example.</p>
<p>The only good news is that the example in question is pretty good, and I will probably use it here. So by default, I&#8217;ll adopt that coding structure, and document it as I go on. My only hope is that it does not break every rule in the &#8220;official&#8221; WordPress plugin book.</p>
<hr />
<h3>WordPress Plugins References</h3>
<ol>
<li id="ref1"><a href="http://wordpress.org/development/2009/12/canonical-plugins/">WordPress › Blog » Canonical Plugins (Say What?)</a> [Internet]. [cited 2009 Dec 22]</li>
<li id="ref2"><a href="http://codex.wordpress.org/WordPress_Coding_Standards">WordPress Coding Standards « WordPress Codex</a> [Internet]. [cited 2009 Dec 22]</li>
<li id="ref3"><a href="http://codex.wordpress.org/Inline_Documentation">Inline Documentation « WordPress Codex</a> [Internet].  [cited 2009 Dec 22]</li>
<li id="ref4"><a href="http://comox.textdrive.com/pipermail/wp-hackers/2006-July/006930.html">[wp-hackers] Coding style</a> [Internet].  [cited 2009 Dec 22]</li>
<li id="ref5"><a href="http://planetozh.com/blog/2009/09/top-10-most-common-coding-mistakes-in-wordpress-plugins/">Top 10 Most Common Coding Mistakes in WordPress Plugins « planetOzh</a> [Internet]. [cited 2009 Dec 22]</li>
<li id="ref6"><a href="http://hungred.com/useful-information/wordpress-plugin-development-tips-tricks/">WordPress Plugin Development Tips And Tricks &#8211; Hungred Dot Com</a> [Internet]. [cited 2009 Dec 16]</li>
<li id="ref7"><a href="http://www.onextrapixel.com/2009/07/01/how-to-design-and-style-your-wordpress-plugin-admin-panel/">How To Design And Style Your WordPress Plugin Admin Panel | Onextrapixel &#8211; Showcasing Web Treats Without Hitch</a> [Internet]. [cited 2009 Dec 16]</li>
</ol>
<p><!--more--><div style="margin-left:-1em;"><table><tr><td><script type="text/javascript"><!--
google_ad_client = "pub-7512621270035949";
/* shrewdies 300x250, created 22/12/09 */
google_ad_slot = "4026195862";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></td><td>
<script type="text/javascript"><!--
ch_client = "GoutPal";
ch_type = "mpu";
ch_width = 300;
ch_height = 250;
ch_color_bg = "ffffff";
ch_color_border = "ffffff";
ch_color_title = "00009e";
ch_color_site_link = "00009e";
ch_non_contextual = 4;
ch_vertical ="premium";
ch_sid = "ShrewdiesReward";
ch_alternate_ad_url = "http://www.shrewdies.net/ad.html";
var ch_queries = new Array( );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//--></script>
<script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript">
</script></td></tr></table></div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shrewdies.net/279/wordpress-plugins-beginners-nightmare/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
