'Allow users to signup to your newsletter easily', 'classname' => 'XXX-signup' ); // Set some control options (width, height etc) $control_options = array( 'width' => 300 ); // Actually create the widget (widget id, widget name, options...) $this->WP_Widget( 'newsletter-signup-widget', 'Newsletter Signup', $widget_options, $control_options ); } // Output the content of the widget function widget($args, $instance) { extract( $args ); // Don't worry about this // Get our variables $title = apply_filters( 'widget_title', $instance['title'] ); $text = $instance['text']; $code = $instance['code']; // This is defined when you register a sidebar echo $before_widget; // If our title isn't empty then show it if ( $title ) { echo $before_title . $title . $after_title; } // If our description isn't empty then show it if ( $text ) { echo '
'. $text .'
'; } // If we have some code then output it if ( $code ) { echo $code; } // This is defined when you register a sidebar echo $after_widget; } // Output the admin options form function form($instance) { // These are our default values $defaults = array( 'title' => 'Example', 'text' => 'Subscribe to our newsletter using the form below.', 'code' => '' ); // This overwrites any default values with saved values $instance = wp_parse_args( (array) $instance, $defaults ); ?>