The widget-item
class is in the $params for registered sidebars in the theme you are using. If you want to remove it and replace it with something else, you can by using the dynamic_sidebar_params
filter or you can find it in your theme (if you are using a parent theme and not a child theme) and just change it, however the results may be not what you expect because the padding and margin is not coming from that class.
This filter below would be added last in your child theme's functions.php file AFTER all other functions and outside of all functions and after all includes/requires. In this example widget-item
will be replaced by my-widget-class
(which you would change). In this situation, .widget-item
or any class here provides a global class to widgets and does not have padding or margin on it as in your image. When you use developer tools, you can clearly see that the child is the element with the margin and the padding.
function prefix_filter_widget_div_wrappper( $params ) {
$params[0]['before_widget'] = '<div class="my-widget-class %2$s">' ;
$params[0]['after_widget'] = '</div>' ;
return $params;
}
add_filter( 'dynamic_sidebar_params' , 'prefix_filter_widget_div_wrappper' );
The issue in your situation is this .newsletter
child of .widget-item
and if you use CSS specificity, you can adjust the appearance for the location:
.newsletter {
padding: 25px;
..etc.
}
Like this:
.site-footer .newseltter {
padding: 10px;
margin: 0;
}
Conditional for dynamic_sidebar_params
filter.
Locate your registered sidebar ID by looking for where it is registered in your theme functions php file(s) parent or child.
function prefix_filter_widget_div_wrappper_conditional( $params ) {
//* where `register-sidebar-id` is the registered sidebar id (you would look for this in your theme's code)
if ( 'registered-sidebar-id' === $params[0][ 'id' ] ) :
$params[0]['before_widget'] = '<div class="my-widget-class %2$s">' ;
$params[0]['after_widget'] = '</div>' ;
endif;
return $params;
}
add_filter( 'dynamic_sidebar_params' , 'prefix_filter_widget_div_wrappper_conditional' );