salcode / bootstrap-genesis

WordPress Genesis Child Theme setup to use Bootstrap, Sass, and Grunt
MIT License
184 stars 63 forks source link

Change for .widget css #129

Closed bryanwillis closed 8 years ago

bryanwillis commented 8 years ago

The way we have it now borders and other styles are being applied to every widget area. This can be a nuisance when most of the time those styles are only desired in the "actual sidebars" not every widget area you create on a site.

We can add the main sidebar widget area names to the css:

.sidebar_primary .widget,
.sidebar_secondary .widget {

}

We can also use the built in Genesis filter for this that only targets the default widget areas:

add_filter( 'genesis_register_widget_area_defaults', 'gb3_register_sidebar_defaults');
function gb3_register_sidebar_defaults( $defaults ) {
    $defaults['before_widget'] = '<section id="%1$s" class="panel panel-default widget %2$s"><div class="panel-body widget-wrap">';
    return $defaults;
}
salcode commented 8 years ago

@bryanwillis Just to clarify, the use case you're coming across is:

This isn't something I've come across but if others would find this useful I like the CSS solution you mention. Changing

.widget

to

.sidebar_primary .widget,
.sidebar_secondary .widget

@dustyndoyle and any others who want to chime in,

  1. Do you come across this situation?
  2. Would this change be helpful?
dustyndoyle commented 8 years ago

@salcode I have never had this problem. I would usually wrap the widget area in a specific class if I wanted to have different styles than the default for that one area.

salcode commented 8 years ago

@bryanwillis while I can certainly see the value of doing this within a theme I'm opposed to have un-styled widget areas by default.

Adding the filter is an interesting idea but recreating the opening <section> tag seems like a lot to add to the theme. Unfortunately, there is not a filter to modify only the classes being added - if there were it might make sense to add a class like bsg-widget and target our styles at it.

I'm going to mark this as won't fix. But thanks for bringing up this conversation.