public/wordpress/wp-content/themes/puro/functions.php
/**
 * Count the footer widgets and add the count to the widget class.
 */
Count the footer widgets and add the count to the widget class.
Count the footer widgets and add the count to the widget class .
function puro_footer_widgets_params( $params ) {
    $sidebar_id = $params[0]['id'];
    if ( $sidebar_id == 'sidebar-2' ) {
        $total_widgets = wp_get_sidebars_widgets();
        $sidebar_widgets = count( $total_widgets[$sidebar_id] );
        $params[0]['before_widget'] = str_replace( 'class="', 'class="widget-count-' . floor($sidebar_widgets) . ' ', $params[0]['before_widget'] );
    }
    return $params;
}
function puro_footer_widgets_params ( $ params ) { $ sidebar_id = $ params [ 0 ] [ 'id' ] ; if ( $ sidebar_id == 'sidebar-2' ) { $ total_widgets = wp_get_sidebars_widgets ( ) ; $ sidebar_widgets = count ( $ total_widgets [ $ sidebar_id ] ) ; $ params [ 0 ] [ 'before_widget' ] = str_replace ( 'class="' , 'class="widget-count-' . floor ( $ sidebar_widgets ) . ' ' , $ params [ 0 ] [ 'before_widget' ] ) ; } return $ params ; }
Count the footer widgets and add the count to the widget class.
Count the footer widgets and add the count to the widget class .