Make WordPress Core

Ticket #12615: garyc40.12615.diff

File garyc40.12615.diff, 1.1 KB (added by garyc40, 14 years ago)

try to do less than hackre's patch, just in case

  • wp-includes/widgets.php

    diff --git wp-includes/widgets.php wp-includes/widgets.php
    index 4c6d4f4..d5cc94b 100644
    function dynamic_sidebar($index = 1) { 
    861861        $sidebar = $wp_registered_sidebars[$index];
    862862
    863863        $did_one = false;
    864         foreach ( (array) $sidebars_widgets[$index] as $id ) {
     864        $widgets = (array) $sidebars_widgets[$index];
     865        $i = 0;
     866        $count = count( $widgets );
     867        foreach ( $widgets as $id ) {
    865868
    866869                if ( !isset($wp_registered_widgets[$id]) ) continue;
    867870
     871                $i ++;
     872               
    868873                $params = array_merge(
    869874                        array( array_merge( $sidebar, array('widget_id' => $id, 'widget_name' => $wp_registered_widgets[$id]['name']) ) ),
    870875                        (array) $wp_registered_widgets[$id]['params']
    function dynamic_sidebar($index = 1) { 
    879884                                $classname_ .= '_' . get_class($cn);
    880885                }
    881886                $classname_ = ltrim($classname_, '_');
     887               
     888                if ($i == 1)
     889                        $classname_ .= ' first';
     890                elseif ( $i == count( $widgets ) )
     891                        $classname_ .= ' last';
     892               
    882893                $params[0]['before_widget'] = sprintf($params[0]['before_widget'], $id, $classname_);
    883894
    884895                $params = apply_filters( 'dynamic_sidebar_params', $params );