Purpose of the plugin
The Wordpress Plugin “MultiWidget Class” adds a class to the Wordpress code base called “MultiWidget”. By following some quite simple rules you can build a widget that can be created multiple times. For this you just have to override two output functions and set some default values. Alle the data processing is automated. My work was heavily inspired by the work described in this article.
How it works
- Include the MultiWidget class file or activate the plugin
- Extend MultiWidget class
- Set initialization variables in the constructor (IMPORTANT)
- Override ‘control_output’ and ‘widget_output’ (IMPORTANT)
- control_output: Echoes the widget control panel to the “Widgets” page
- widget_output: Prints the generated widget to the front-end. - Override ‘admin_head’ (optional)
- Write a function that instantiates an object of your class
- Add an action to call the function from (6) when all plugins have been loaded (‘plugins_loaded’)
Hint: use the sample class at the end of the PHP source file as a starting point! Try the sample widget by uncommenting the last line of code in the file and activate the plugin. The new multi-widget should be ready to use!
The Pity
After I wrote this plugin in hours of work I found that a similar solution has already been found by others. The functionality will even be available in the 2.8 release of the wordpress core…
Download
Dowload link is HERE
Questions? Comments?
If you have any comments or questions regarding the plugin, please write a comment. I will answer as soon as possible.
Similar Posts: