I coded my own answer together using a filter and dynamic_sidebar_params
:
<?php
add_filter('dynamic_sidebar_params','io_blogroll_class');
function io_blogroll_class($params){
$params[0]['before_widget'] = '<li class="'.$params[0]['widget_name'].' box">';
$params[0]['after_widget'] = '</li><!--'.$params[0]['widget_name'].'-->';
if ($params[0]['widget_name'] == "Links"){
$params[0]['before_widget'] = '<li class="'.$params[0]['widget_name'].'">';
$params[0]['after_widget'] = '</li><!--'.$params[0]['widget_name'].'-->';
}
return $params;
}
?>
The first lines actually override whatever you programmed register_sidebar()
or register_sidebars()
to put before and after a widget. So you can safely leave that blank in register_sidebar()
if you’re using this code. The first lines of the function make the name of the widget (therefore the type) a class of the list item and give a default class of .box
to all widgets. The if
statement basically says, “If any of the widgets have the class .Links
(which they will if they’re a blogroll or linklist) change the XHTML list item tags before and after these widgets to use their widget name as their only class.”
I hope this code helps a few people who are staring down the same question.