Created
May 15, 2012 17:44
-
-
Save retlehs/2703644 to your computer and use it in GitHub Desktop.
Add a class to widgets in a specific sidebar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add 'class="span4"' to all widgets in the Content Bottom sidebar | |
*/ | |
function bb_content_bottom_widget_class($params) { | |
if ($params[0]['id'] == 'roots-content-bottom') { | |
$class = 'class="span4 '; | |
$params[0]['before_widget'] = preg_replace('/class=\"/', "$class", $params[0]['before_widget'], 1); | |
} | |
return $params; | |
} | |
add_filter('dynamic_sidebar_params', 'bb_content_bottom_widget_class'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment