The attached converts the WP dashboard into a collection of widgets. These widgets are the same as "ordinary" WP widgets, but are a little bit souped up:
- Widget display and widget configuration are done on the same screen.
- Widgets can be 1/3, 1/4 1/2 or 1/1 of the dashboard width (example: all widgets in patch are 'half' width except the planet widget which is 'full' width).
- Widgets can be single or double high (no example, but can pass 'height' => 'double').
There is no interface for reordering widgets or adding new ones. I don't expect there to be such a UI until WP 2.6 at least. Hooks are available for plugins to register new widgets and to set/modify the order:
// Hook to register new widgets
do_action( 'wp_dashboard_setup' );
// Filter widget order
$dashboard_widgets = apply_filters( 'wp_dashboard_widgets', $dashboard_widgets );
Widgets are registered like ordinary WP widgets, but take a few more parameters (all optional):
wp_register_sidebar_widget( $widget_id, $widget_name, $widget_callback,
array(
'all_link' => [full url for "See All" link],
'feed_link' => [full url for "RSS" link],
'width' => 'third', 'fourth', 'HALF', 'full',
'height' => 'SINGLE', 'double'
)
);
wp_register_widget_control(
$widget_id,
$widget_control_name,
$widget_control_callback,
array(), // Just leave it blank: oddity in widget code
array(
'widget_id' => $widget_id // Yes - again. This is required: oddity in widget code
)
);
Widgets do not need controls. Those with controls will show an "Edit" link and can be edited "in place" (new page load).
The dynamic_sidebar() function has been modified (in a backward compatible way) to handle some of the dashboard requirements:
- New hooks: dynamic_sidebar_params
- widget_id and widget_name are now passed to the widget_callback function along with before_title and friends.
Since most of the default widgets are specialized RSS widgets, the wp_widget_rss_*() functions have been broken up a bit more to accommodate the needed re-use.
Particularly hacky things are noted in the code.