With a bit of down time I have been working feverishly to clean up my framework, focusing on speed, code etc. During the process I got to thinking about the way the theme registers it’s sidebars so I dug in and did a little research.
Having research quite a bit I stumbled on this short article at wpengineer.com, an excellent resource that I highly recommend. Anyhow having had a look at their implementation of register_sidebars, I agreed completely. The process and the code could definitely be cut down quite a bit.
After some experimentation I settled on this little snippet below:
function mytheme_register_sidebars() {
$sidebars;
$sidebars['One Sidebar'] = 'one-sidebar';
$sidebars['Two Sidebar'] = 'two-sidebar';
$sidebars['Three Sidebar'] = 'three-sidebar';
foreach ($sidebars as $key=>$value ) {
register_sidebar(array(
'name' => $key,
'id' => $value,
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>',
));
}
}