Opened 14 years ago
Last modified 5 years ago
#16613 new enhancement
Extend Widget API to allow sidebar/widget manipulation
Reported by: | Viper007Bond | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.1 |
Component: | Widgets | Keywords: | needs-patch |
Focuses: | Cc: |
Description
There is currently no easy way to add a widget to a sidebar using code. We should add methods of doing this.
A good example usage of such an API could be when a new theme is activated, it could add it's custom widgets to it's sidebar.
API should provide support for adding widget X to sidebar Y (or even just the first sidebar) along with setting some options for the widget and where in the sidebar to add it (top vs. bottom).
Change History (12)
#3
in reply to:
↑ 2
@
14 years ago
Replying to ryan:
Trying to decide if I would deactivate on the spot any theme that did this. ;-)
Ha, okay, maybe not the greatest example, but I have legitimate usage for this API. :P
#4
@
13 years ago
- Cc sirzooro added
- Keywords dev-feedback 2nd-opinion needs-codex added
+1 for this.
I am going to create custom wizard-like plugin, which will allow to quickly configure new site. It will perform following tasks:
- gather few configuration details from user;
- activate plugins and configure them;
- set theme;
- add widgets and configure them.
So far it looks that last step will be the most difficult, because Widgets Management API is mostly undocumented, and some operations are even available via admin-ajax.php only.
If is is possible, please document at least some operations on Codex now. For code changes it is probably too late to include them in 3.3, so please target them for 3.4. It will be good to change this ticket to Blessed Task for 3.4.
#9
@
10 years ago
For an example API (at least for the kinds of operations that can be performed), see what was recently added to WP-CLI for widget management: https://github.com/wp-cli/wp-cli/blob/master/php/commands/widget.php
Trying to decide if I would deactivate on the spot any theme that did this. ;-)