Add class to before_widget from within a custom widget

Aha, so the $before_widget variable is a string representing div element: <div class=”widget my” id=”my-widget-1″> . So I checked the $before_widget for the “class” sub-string and added my $widget_width value to it. The code is from my custom widget file: function widget( $args, $instance ) { extract( $args ); … //other code $widget_width = !empty($instance[‘widget_width’]) … Read more