
In a comment posted for the article Genesis Framework: Add a Custom CSS Class to Elements, Michael Caiati asked:
I am trying to add a a class to the images in the featured post widget. What would I use to achieve that. I tried genesis_attr_entry-image it did not work. Thanks
Adding the following code to the Genesis/Theme Settings header script area solves his problem:
How This Works
You may not be familiar with the selector used in the jQuery example above. This is a wildcard selector that targets all div elements with an id beginning with “featured post widgets". Wildcard selectors are extremely useful for targeting elements of a specific type. Wildcard selectors work for jQuery and CSS. To learn more about wildcard selectors, please visit http://api.jquery.com/category/selectors/
If you are using Genesis 2.1.3 beta then you can try this:
add_filter( 'genesis_attr_entry-image-widget', 'gd_add_custom_class_fp' );
function gd_add_custom_class_fp( $attr ) {
$attr['class'] = 'my-own-class';
return $attr;
}
Thanks for contributing Chinmoy. This code will add the additional class to any entry-image in any type of widget on the page. The OP is asking how to limit the class to featured widget images only. As far as I know, this hook became available in Genesis 2.1.2.