1 | | In the work on the Widgets UI Refresh feature-as-plugin group, the idea was raised about adding support for icons and screenshots to widgets. Right now, widgets only have textual information (name and description) to clue in users as to what they do. If, however, widgets had icons then users would be able to much more quickly find the widget they're looking for (especially if they've used them before). Likewise, if a widget had a screenshot thumbnail which captured what a typical instance looks like, users would be able to more quickly decide if they want a widget or not. Admin menus already have icons, as `add_menu_page()` takes an `icon_url` as one of its arguments. Also, themes are supposed to have a `screenshot.png` which is then displayed on the theme picker. |
2 | | |
3 | | I'm suggesting that `WP_Widget` add support for `icon_url` and `screenshot_url` arguments: |
4 | | |
5 | | {{{ |
6 | | class My_Widget extends WP_Widget { |
7 | | /* ... */ |
8 | | function __construct() { |
9 | | parent::__construct( |
10 | | 'my-wdiget', // Base ID |
11 | | __( 'My Widget', 'text_domain'), // Name |
12 | | array( |
13 | | 'description' => __( 'So widgetized!', 'text_domain' ), |
14 | | 'icon_url' => plugin_dir_url( __FILE__ ) . '/icon.png', |
15 | | 'screenshot_url' => plugin_dir_url( __FILE__ ) . '/screenshot.png', |
16 | | ) |
17 | | ); |
18 | | } |
19 | | /* ... */ |
20 | | }}} |
21 | | |
22 | | The widget icons could then be displayed on the widgets page and anywhere else that widgets are managed, to allow them to be easily recognized. The `WP_Widget` would need to have a generic default widget icon, and icons should be created for all widgets distributed with core. |
23 | | |
24 | | For the widget screenshot, sure it would not be reflective of how it would exactly appear in the current theme, but it would give a good visual overview of what you’re going to get when you add the widget. |
25 | | |
26 | | The above functionality could (and should) be implemented first as a plugin (e.g. as part of the Widgets UI Refresh), but I wanted to create a ticket in Trac to capture the feature request and invite broader discussion. |
| 1 | With the incorporation of live widget previews (widget customizer), an available widget browser is displayed which lists all widgets along with a dashicon for each. These icons should be incorporated into the widgets admin page now, as well. |