mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Set widget classname when passed string, object/method, object-reference/method. fixes #4910
git-svn-id: http://svn.automattic.com/wordpress/trunk@6098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1f3ce09d52
commit
0880ca8693
@ -210,7 +210,14 @@ function dynamic_sidebar($index = 1) {
|
||||
$params = array_merge(array($sidebar), (array) $wp_registered_widgets[$id]['params']);
|
||||
|
||||
// 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_);
|
||||
|
||||
if ( is_callable($callback) ) {
|
||||
|
Loading…
Reference in New Issue
Block a user