WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#12163 closed defect (bug) (fixed)

Setup default widgets when installing

Reported by: ryan Owned by: azaozz
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9.1
Component: Widgets Keywords: needs-patch
Focuses: Cc:

Description

A common source of confusion is how the default sidebar that is hard-coded for themes when no widgets are configured "disappears" entirely when go to the widget admin and adding a widget. What is displayed on the front should match what is displayed on the admin. Doing this in a back compat way for all themes is difficult, but we can at least setup some default widgets for the default theme so the out-of-the-box experience for a fresh install is better.

Attachments (2)

12163.diff (1.7 KB) - added by ryan 4 years ago.
12163-2.diff (1.6 KB) - added by azaozz 4 years ago.

Download all attachments as: .zip

Change History (6)

ryan4 years ago

azaozz4 years ago

comment:1 azaozz4 years ago

The patch looks good, cleaned it a bit. Was thinking we could use add_option() so if somebody is re-running the install it wouldn't overwrite already defined widgets, but perhaps the expected behavior would be to overwrite them.

We need to add support for default widgets to register_sidebar so theme authors can pre-register widgets there when the sidebar is empty instead of hard-coding them in the theme. That has to happen on the next page load after a theme is activated.

Was thinking to drop most of the back-compat code in the widgets API and improve register_sidebar (there are several tickets about it) but perhaps that's better left for 3.1.

comment:2 automattor4 years ago

(In [13033]) Setup some default widgets for the default theme at install. Props azaozz. see #12163

comment:3 nacin4 years ago

  • Keywords needs-patch added

What I'm seeing here left on the todo is that register_sidebar() needs the ability for pre-registration of widgets. Thinking that's important for 3.0 to go along with the change in [13033].

comment:4 ryan4 years ago

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.