Object Oriented WordPress Plugin Development

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 🙂

This entry was posted in Development, Personal Notes, Support. Bookmark the permalink.

3 Responses to Object Oriented WordPress Plugin Development

  1. Zach says:

    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?

  2. Jason Nathan says:

    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…

Leave a Reply

Your email address will not be published. Required fields are marked *

Please wrap any HTML markup or code with the pre-formatted tag: <pre> </pre>