Set widget classname when passed string, object/method, object-reference/method. fixes #4910
git-svn-id: https://develop.svn.wordpress.org/trunk@6098 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
88c31f17b1
commit
41f61e4056
|
@ -210,7 +210,14 @@ function dynamic_sidebar($index = 1) {
|
||||||
$params = array_merge(array($sidebar), (array) $wp_registered_widgets[$id]['params']);
|
$params = array_merge(array($sidebar), (array) $wp_registered_widgets[$id]['params']);
|
||||||
|
|
||||||
// Substitute HTML id and class attributes into before_widget
|
// Substitute HTML id and class attributes into before_widget
|
||||||
$classname_ = ( is_array($wp_registered_widgets[$id]['classname']) ) ? implode('_', $wp_registered_widgets[$id]['classname']) : $wp_registered_widgets[$id]['classname'];
|
$classname_ = '';
|
||||||
|
foreach ( (array) $wp_registered_widgets[$id]['classname'] as $cn ) {
|
||||||
|
if ( is_string($cn) )
|
||||||
|
$classname_ .= '_' . $cn;
|
||||||
|
elseif ( is_object($cn) )
|
||||||
|
$classname_ .= '_' . get_class($cn);
|
||||||
|
}
|
||||||
|
$classname_ = ltrim($classname_, '_');
|
||||||
$params[0]['before_widget'] = sprintf($params[0]['before_widget'], $id, $classname_);
|
$params[0]['before_widget'] = sprintf($params[0]['before_widget'], $id, $classname_);
|
||||||
|
|
||||||
if ( is_callable($callback) ) {
|
if ( is_callable($callback) ) {
|
||||||
|
|
Loading…
Reference in New Issue