Modify the Featured Image CSS Classes in Genesis

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
 * @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' );

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk