Looking back at one’s code from years prior is like looking back at a junior high school picture of one’s self. I’m looking back at the code for my quick-and-dirty pie chart plugin and think, man, why did I write things THAT way?
In the 1,000 years since I wrote that plugin in 2009, I’ve been trying to learn and comply with best programming practices for WordPress plugins. As a result my current plugins tend to be stripped down, simple, don’t create unnecessary options, don’t create unnecessary tables, taxonomies, special post types, or those kinds of things. 1 Learning some Object Oriented programming along the way has been super helpful. By encapsulating your WordPress plugin code into a chunk of objected oriented programming, you reduce the likelihood that your plugins’ function and variable names will collide with those from WordPress or other potential plugins.
If you’re getting started or need to brush up on your WordPress plugin development skillz, you should definitely check out these awesome articles:2
- Object Oriented PHP for Beginners
- WordPress Codex: Writing a Plugin
- Adding Administration Menus
- How to design and style your WordPress plugin admin panel
- AJAX in Plugins
- Top 10 Most Common Coding Mistakes in WordPress Plugins (11SEP09)
- WordPress 2.0.3: Nonces (Secure your forms with nonces) (02JUN06)
- Simplified AJAX For WordPress Plugin Developers using jQuery(10APR08)
- “Desenvolvendo Plugins para WordPress” by Rafael Dohms (in Brazilian Portuguese) (10MAR08)
- 12 part “How to Write a WordPress Plugin” at DevLounge.net by Ronald Huereca (PDF)
- How to create WordPress Plugin from a scratch (9AUG07)
- HookPress, a plugin that enables extending WordPress in languages other than PHP via webhooks. (26SEP09)
- How To Include CSS and JavaScript Conditionally And Only When Needed By The Posts (13JAN10)
- Demonstrating how to use the Settings API, WP_Http, and Pseudo-cron (01MAR10)
I’d also recommend tinkering with jQuery and JSON, if you haven’t already. 3 I don’t know of any really good JSON tutorials, so if you do, please let me know so I can add it to this list.
- Admittedly, I’m not really shooting for super ambitious plugins either. [↩]
- Mostly stolen from the WordPress Codex! [↩]
- I only use JSON for passing data from the browser to the server via AJAX and then decoding into a PHP object. [↩]