Opened 17 months ago

#19709 new enhancement

Add 'before_sidebar' and 'after_sidebar' attributes to register_sidebar()

Reported by: dgwyer Owned by:
Priority: normal Milestone: Awaiting Review
Component: Widgets Version: 3.3
Severity: normal Keywords:
Cc:

Description

Whilst experimenting with some code recently I needed to have each widget area wrapped inside a container with the widget id as the container CSS class/id.

If used in a theme this widget area container usually has to be hard coded. This is the case for Twenty Ten, and Twenty Eleven.

It occurred to me that it would be very useful to have an extra couple of attributes available in register_sidebar() such as 'before_sidebar' and 'after_sidebar' so that developers have a consistent way to automatically add a wrapper to each widget area.

It would be additionally useful if you could do something like this to add the widget area id as the wrapper CSS class/id as required:

'before_sidebar' => '<div class="%3$s">'
'after_sidebar' => '</div>'

or

'before_sidebar' => '<div id="%3$s">'
'after_sidebar' => '</div>'

If this feature is considered then I'm not sure whether 'before_sidebar' or 'before_widget_area' is a better choice for the attribute name.

Change History (0)

Note: See TracTickets for help on using tickets.