Registering a plugin as a widget
-
I’ve got a fairly popular plugin (fundraising-thermometer-plugin-for-wordpress) that I’m trying to get running as a widget but the code is throwing errors when I add the code:
class OurProgress extends WP_Widget { function OurProgress() { $widget_ops = array('classname' => 'our_progress', 'description' => 'Our Progress' ); $this->WP_Widget('our_progress', 'Our Progress', $widget_ops); } function widget($args, $instance) { extract($args, EXTR_SKIP); echo show_ourprogress_graphic();} function update($new_instance, $old_instance) {} function form($instance) {} } register_widget('OurProgress');
If I add this code to the function file, it works perfectly but not in a plugin file.
Can anybody help? I’d love to add the functionality to the plugin but widgets are outside my area of comfort.
thanks
- The topic ‘Registering a plugin as a widget’ is closed to new replies.