Plugin class organization, best practice
-
Hi all!
I’m busy writing a new plugin and have reached a stage where I’d like to know what the best practice for class organization is. More specifically, I’d like to find out what the best way of linking classes together is.
At the moment I have the following classes/components that need to be linked together wisely:
MyPlugin (singleton)
MyPlugin_Options (singleton)
MyPlugin_Shortcode
MyPlugin_WidgetWhich ones should extend which ones? And which ones should be singletons or not or what.
The way I thought it would make sense:
MyPlugin (singleton)
MyPlugin_Options (singleton)
MyPlugin_Shortcode
MyPlugin_Widget extends MyPlugin_ShortcodeFor the widget class, it should be extending WP_Widget, but obviously I can’t extend both at the same time.
So how should I organize my classes to have them all linked together nicely?Hope it’s clear what I mean…
Thanks for your help!
- The topic ‘Plugin class organization, best practice’ is closed to new replies.