{"id":291,"date":"2010-04-06T19:49:04","date_gmt":"2010-04-06T23:49:04","guid":{"rendered":"http:\/\/www.ocwordcamp.com\/?p=291"},"modified":"2010-04-06T19:49:04","modified_gmt":"2010-04-06T23:49:04","slug":"pimp-your-wordpress-plugin","status":"publish","type":"post","link":"https:\/\/oc.wordcamp.org\/2011\/pimp-your-wordpress-plugin\/","title":{"rendered":"Pimp Your WordPress Plugin"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-302\" style=\"padding-right: 5px;padding-bottom: 5px\" src=\"http:\/\/www.ocwordcamp.com\/wp-content\/uploads\/2010\/04\/iStock_000001071520Large-200x300.jpg\" alt=\"WordPress Pimp\" width=\"180\" height=\"270\" srcset=\"https:\/\/oc.wordcamp.org\/2011\/files\/2010\/04\/iStock_000001071520Large-200x300.jpg 200w, https:\/\/oc.wordcamp.org\/2011\/files\/2010\/04\/iStock_000001071520Large-683x1024.jpg 683w, https:\/\/oc.wordcamp.org\/2011\/files\/2010\/04\/iStock_000001071520Large.jpg 1811w\" sizes=\"auto, (max-width: 180px) 100vw, 180px\" \/>Most WordPress Plugins are little more than small utilities but there are a growing number of them that can <em>dramatically<\/em> augment the way WordPress behaves or give WordPress advanced new features.<\/p>\n<p style=\"font-size: 16px\"><strong>Platform Modifying Plugins<\/strong><\/p>\n<p>I like to refer to these plugins as <strong><em>Platform Modifying Plugins<\/em> (PMPs or Pimps)<\/strong> because even though they exist in the same repository with all these other smaller, utility plugins, they are more substantial with more features. A few examples of PMPs include <a href=\"http:\/\/wordpress.org\/extend\/plugins\/buddypress\/\">BuddyPress<\/a> (and my own lighter-weight alternative &#8212; <a href=\"http:\/\/wordpress.org\/extend\/plugins\/mingle\/\">Mingle<\/a>), <a href=\"http:\/\/wordpress.org\/extend\/plugins\/nextgen-gallery\/\">NextGEN Gallery<\/a>, <a href=\"http:\/\/wordpress.org\/extend\/plugins\/wptouch\/\">WPTouch<\/a>, <a href=\"http:\/\/wordpress.org\/extend\/plugins\/pretty-link\/\">Pretty Link<\/a> and <a href=\"http:\/\/wordpress.org\/extend\/plugins\/formidable\/\">Formidable<\/a>. Many of these PMPs have also become platforms themselves sporting their own hooks and APIs &#8212; with other 3rd party plugins in the repository that alter <em>their<\/em> behavior.<\/p>\n<p>In my presentation at OC WordCamp, I&#8217;m going to show you an effective way to develop your own PMPs using a <strong>Model View Controller (MVC)<\/strong> approach with some additional tips and tricks that I&#8217;ve learned from coding and supporting two different PMPs.<!--more--><\/p>\n<p style=\"font-size: 16px\"><strong>Model View Controller<\/strong><\/p>\n<p>Even though there is no right or wrong way to program a WordPress plugin (as long as it works and doesn&#8217;t blow up the user&#8217;s website) &#8212; when writing a PMP, special thought should be given to how your it will be structured. One common design pattern to create a robust web app is MVC. Many other development environments across several other languages such as <a href=\"http:\/\/www.springsource.org\/\">Spring<\/a> (a Java Web Development Framework), <a href=\"http:\/\/struts.apache.org\/\">Struts<\/a> (another Java Framework), <a href=\"http:\/\/rubyonrails.org\/\">Ruby on Rails<\/a> (an outstanding framework that I&#8217;ve used on many other projects), <a href=\"http:\/\/cakephp.org\/\">Cake<\/a> (a pure PHP framework based on Rails) and even the <a href=\"http:\/\/developer.apple.com\/iphone\/index.action\">iPhone Development Framework<\/a> utilize an MVC approach.<\/p>\n<p>I&#8217;ve found using a very lightweight, MVC approach in my development efforts has helped me to handle the complexity that can come in when writing a PMP.<\/p>\n<ul>\n<li>MVC can make a larger code-base more manageable<\/li>\n<li>MVC can make it easier to write more stable code<\/li>\n<li>MVC can make it easier to pinpoint bugs and performance bottlenecks<\/li>\n<li>MVC can make it easier to work along side other developers<\/li>\n<li>MVC can make your plugin easier to readable and therefore extend-able by other developers<\/li>\n<\/ul>\n<p style=\"font-size: 16px\"><strong>My WordCamp Presentation<\/strong><\/p>\n<p>So in addition to this focus on MVC, I&#8217;m also planning on sharing some other extremely valuable tips for those wanting to start their own PMP&#8230; I&#8217;m planning on covering the basics of the following items (hopefully I&#8217;ll have time to cover them all):<\/p>\n<ul>\n<li><strong>Routing Admin, Front end and AJAX requests through your Plugin<\/strong> &#8212; I really wish I knew some of this information when I first started writing wordpress plugins. These ideas (especially the AJAX routing) were based on some suggestions I got from Brandon (the organizer of ocwordcamp) &#8212; but building a routing concept into your plugin can save you countless hours of user support, debugging and bug fixing.<\/li>\n<li><strong>Optimizing your Plugin<\/strong> &#8212; I think that most plugin developers don&#8217;t really consider the impact their plugins can have on memory consumption, page loads, etc. Well, when you are putting together a PMP, you can really wreak havoc on your users systems so this is critical.<\/li>\n<li><strong>Translating your Plugin <\/strong>&#8212; There&#8217;s a lot of documentation out there for this &#8212; but I had some issues when I first started getting this to work in Mingle. I&#8217;ll cover some of the gotchas that I had so that hopefully you can get over some of the troubles I had.<\/li>\n<li><strong>Deploying your Plugin <\/strong>&#8212; This is an often overlooked topic for plugin developers. Many of them aren&#8217;t familiar with SVN or have no clue how to put together a process so that deployment is a seamless, repeatable process. This becomes even more critical when you start translating your plugin and if you do a <a href=\"http:\/\/www.ocwordcamp.com\/211\/how-to-create-a-premium-wordpress-plugin\/\">premium version of your plugin<\/a>. I&#8217;ll try to break down the steps I go through to create a release of my plugin.<\/li>\n<li><strong>Database Management <\/strong>&#8212; If you&#8217;re writing a PMP you will no doubt be adding\u00a0 tables to the WordPress database. I&#8217;ll show you how I create, update and migrate these tables. Also, I&#8217;ll show you some easy conventions (taken from Rails) that will help you clean up your database tables for you and others looking at them.<\/li>\n<\/ul>\n<p>I&#8217;m really pumped about this presentation and my other one on <a href=\"http:\/\/www.ocwordcamp.com\/211\/how-to-create-a-premium-wordpress-plugin\/\">Premium Plugins<\/a> &#8212; hope to see you at both of them!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most WordPress Plugins are little more than small utilities but there are a growing number of them that can dramatically augment the way WordPress behaves or give WordPress advanced new features. Platform Modifying Plugins I like to refer to these &hellip; <a href=\"https:\/\/oc.wordcamp.org\/2011\/pimp-your-wordpress-plugin\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":6138191,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"categories":[4977,4980],"tags":[4985,4990,4991,4992,4997,5003,5005,5007,146,5011,5012,338,14],"class_list":["post-291","post","type-post","status-publish","format-standard","hentry","category-general-awesomeness","category-presentation-topics","tag-ajax","tag-database","tag-deployment","tag-design-pattern","tag-java","tag-model-view-controller","tag-mvc","tag-optimization","tag-plugin","tag-routing","tag-ruby-on-rails","tag-translation","tag-wordpress"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1oLzi-4H","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/oc.wordcamp.org\/2011\/wp-json\/wp\/v2\/posts\/291","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oc.wordcamp.org\/2011\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oc.wordcamp.org\/2011\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oc.wordcamp.org\/2011\/wp-json\/wp\/v2\/users\/6138191"}],"replies":[{"embeddable":true,"href":"https:\/\/oc.wordcamp.org\/2011\/wp-json\/wp\/v2\/comments?post=291"}],"version-history":[{"count":0,"href":"https:\/\/oc.wordcamp.org\/2011\/wp-json\/wp\/v2\/posts\/291\/revisions"}],"wp:attachment":[{"href":"https:\/\/oc.wordcamp.org\/2011\/wp-json\/wp\/v2\/media?parent=291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oc.wordcamp.org\/2011\/wp-json\/wp\/v2\/categories?post=291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oc.wordcamp.org\/2011\/wp-json\/wp\/v2\/tags?post=291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}