[wp-trac] [WordPress Trac] #19450: the_widget won't replace the widget class if not using the default sidebar arguments

WordPress Trac wp-trac at lists.automattic.com
Mon Dec 5 21:29:42 UTC 2011


#19450: the_widget won't replace the widget class if not using the default sidebar
arguments
--------------------------+-----------------------------
 Reporter:  Felipelavinz  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:
 Severity:  minor         |   Keywords:  needs-patch
--------------------------+-----------------------------
 When using the_widget(), the $before_widget argument only receives the
 widget class if using the default sidebar arguments...

 on lines 1129 - 1130 of wp-includes/widgets.php (wp 3.3 rc 1)


 {{{
 $before_widget = sprintf('<div class="widget %s">',
 $widget_obj->widget_options['classname'] );
 $default_args = array( 'before_widget' => $before_widget, 'after_widget'
 => "</div>", 'before_title' => '<h2 class="widgettitle">', 'after_title'
 => '</h2>' );

 $args = wp_parse_args($args, $default_args);
 }}}


 could be replaced by:


 {{{
 $default_args = array( 'before_widget' => '<div class="widget %s">',
 'after_widget' => "</div>", 'before_title' => '<h2 class="widgettitle">',
 'after_title' => '</h2>' );

 $args = wp_parse_pargs($args, $default_args);
 $args['before_widget'] = sprintf($args['before_widget'],
 $widget_obj->widget_options['classname']);
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19450>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list