Excluding specific widgets from default sidebar class
Question
I have two sidebars using the register_sidebars
function that display each widget as a list item with a class of .box
:
<?php if(function_exists('register_sidebars')){
register_sidebars(2, array(
'name'=>'sidebar%d',
'id' =>'sidebar',
'before_widget'=>'<li class="box">',
'after_widget'=>'</li><!--box--><!--aside-->',
'before_title'=>'<h2>',
'after_title'=>'</h2>',
));
}
?>
So the output goes something like:
<div class="side">
<ul>
<li class="box">
<div class="textwidget">Lorem ipsum</div>
</li><!--box--><!--aside-->
<li class="box">
<h2>Blogroll</h2>
<ul class="xoxo blogroll">
<li><a href="http://example.com">Example</a></li>
</ul>
</li><!--box--><!--aside-->
</ul>
</div>
What I need is a conditional function so that any Links widget (or one with a class of .xoxo
) in the sidebars will not get a class of .box
because I want to style those and only those differently, and in a way that I can simply change certain styles from inside of .box
. The main problem is that I don't know what function or variables to target with a filter. The codex doesn't do a good job of classifying less-used global variables and I can't see anything in the Filter Reference that looks like it should help.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange