WordPress.org

Ready to get started?Download WordPress

Forums

Registering a plugin as a widget (1 post)

  1. christopherross
    Member
    Posted 3 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by christopherross
  • This topic is not resolved
  • WordPress version: 2.9.2