Genesis has a useful filter for modifying the attributes of almost any element it outputs. For instance, the featured image on archive pages has an attribute name of ‘entry-image’, so can be modified using the filter genesis_attr_entry-image
.
The code below allows you to add a custom CSS class to the featured image using this filter.
/**
* Modify the Featured Image CSS Classes
* @author Bill Erickson
* @link https://www.billerickson.net/code/genesis-featured-image-classes
*
* @param array $attr, existing attributes
* @return array $attr
*/
function be_genesis_featured_image_classes( $attr ) {
$attr['class'] .= ' custom-class';
return $attr;
}
add_filter( 'genesis_attr_entry-image', 'be_genesis_featured_image_classes' );