From 0880ca86936d99698da31f266ec11835cbf38697 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Wed, 12 Sep 2007 20:48:21 +0000 Subject: [PATCH] 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 --- wp-includes/widgets.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 0defdf4d3..b7ca59bbe 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -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) ) {