I am curious about what kind of ideas and designs are out there for making your WordPress plugin follow a more object oriented approach. Most plugins I have looked at are basically a long list of functions that are hooked into WordPress. These functions then call each other for specific needs. Is there a better way to organize your plugin's code? Yes. In pursuit of a gold standard design paradigm I am going to post my plugin's code structure on this website tomorrow. Please come and leave your opinions and insights, Cheers 🙂
Software Updates
- Latest Stable Release: 1.7.0
- WP Plugin Repository Page
- Requires: WordPress 3.3+
Highlighted Features
- WYSIWYG Editor
- Organize Custom Galleries
- SideBar Widgets
- Pagination
- New Template Rendering System
- Flash Upload For Multiple Files
- Non Square Thumbnails
- Multiple Images Per Catalog Item
- Web 2.0 LightBox
- Enhanced Admin Interface
- Import/Export Backup Files
- WP MultiSite Compatible
Sponsor
Examples
Top Pages
Recent Comments
Categories
Archives
So far my class structure looks something like this….
class {
– private values for my plugin
– construction method which loads wp globals ($wpdb, $now) into the plugin class
– set hooks method (links local class methods to wp hooks)
– action methods for the wp hooks (activate, deactivate, admin-menu, shortcode, etc.)
– database methods called by the action methods (abstraction, abstraction…)
– support methods (general library)
}
obviously a few things could be broken off into sub-classes and that will be the next step. Maybe a general set hooks method that would auto load if a method with a certain name was present in the class….hum. Anyways for now I am enjoying myself playing with WordPress. Any comments?
I posted a simple router class on my website to work with wordpress plugin development on my new blog! You can have a look at it in my website link above…
My approach;
https://github.com/eabay/oo-wordpress