Ticket #6071 (new defect)

Opened 6 months ago

Last modified 2 months ago

register_sidebars should allow name to be an array

Reported by: AaronCampbell Assigned to: mdawaffe
Priority: normal Milestone: 2.9
Component: General Version:
Severity: normal Keywords: has-patch needs-testing
Cc:

Description

register_sidebars allows you to give a name with a %d in it, but you can't register multiple sidebars with unique names. It seems like you should be able to pass an array of names to be used, like this: register_sidebars(array('name'=>array('left','right'))); Which would create two sidebars, one named left, and one named right.

Attachments

wordpress-widgets.diff (0.7 kB) - added by AaronCampbell on 03/02/08 18:41:13.
Fix for register_sidebars

Change History

03/02/08 18:41:13 changed by AaronCampbell

  • attachment wordpress-widgets.diff added.

Fix for register_sidebars

03/02/08 18:43:00 changed by AaronCampbell

Well, there was a problem in the diff AND in the description. I fixed the diff, and the register_sidebars call should look like this: register_sidebars(2, array('name'=>array('left','right')));

03/02/08 21:37:57 changed by ryan

  • owner changed from anonymous to mdawaffe.

04/03/08 14:49:48 changed by AaronCampbell

Any idea where we stand on this? The patch is working great for me, even with 2.5

04/07/08 14:23:22 changed by AaronCampbell

  • milestone changed from 2.6 to 2.5.1.

04/17/08 20:29:43 changed by mdawaffe

How would (array) $argsname? match up with (string) $argsid??

04/17/08 22:29:56 changed by AaronCampbell

Honestly, I've never used the ID option there, so I guess I overlooked it. I suppose we could either accept another array that we assume is in the same order as the name, or we could accept an array of arrays, each one containing name, id, etc.

It seems like it might be even easier to push more of the processing to register_sidebar(). For example, if there is only one sidebar, why aren't we passing it straight to sidebar? If there is more than one to add, it seems like we should check if $args is an array of string or an array of arrays. If it's an array of strings, we should call register_sidebar($args) $number times. If it's an array of arrays, then we should loop through $args, calling register_sidebar() for each, either using the [0] index for any extras (for example, $args contains 4 arrays, but 5 sidebars were requested to be added), or passing nothing to register_sidebar(), letting it use the defaults.

07/15/08 16:24:07 changed by ryan

  • milestone changed from 2.5.2 to 2.9.

Milestone 2.5.2 deleted