Widgets redesign

All of the redesigned widgets functionality is in place in trunk. Only remaining is some improvement to the visual design for the widgets screen in admin.

The new way to add widgets to WordPress is by extending WP_Widget. All widgets created that way have support for multiple instances.

Also all existing widgets will have to be converted to this system as the previous API functions will (most likely) be removed in 2.9. This is quite easy and any of the default widgets can be used as an example.

A typical widget is constructed as follows:

class WP_Widget_Archives extends WP_Widget {
	function WP_Widget_Archives() {
		$widget_ops = array('classname' => 'widget_archive', 'description' => __( "A monthly archive of your blog's posts") );
		$this->WP_Widget(false, __('Archives'), $widget_ops);

	function widget( $args, $instance ) {
		// displays the widget on the front end

	function update( $new_instance, $old_instance ) {
		// update the instance's settings

	function form( $instance ) {
		// displays the widget admin form

// register the widget
add_action('widgets_init', 'my_super_widget_init');
function my_super_widget_init() {

For more details and examples check wp-includes/widgets.php and wp-includes/default-widgets.php.