Skip to content

Instantly share code, notes, and snippets.

@generatepress
Last active May 5, 2016 07:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save generatepress/c5bc0ee37bb767a703c5 to your computer and use it in GitHub Desktop.
Save generatepress/c5bc0ee37bb767a703c5 to your computer and use it in GitHub Desktop.
Add class to all featured images
function generate_custom_image_attributes( $attr ) {
remove_filter('wp_get_attachment_image_attributes','generate_custom_image_attributes');
if ( is_single() )
$attr['class'] .= ' no-lazy';
return $attr;
}
add_filter('wp_get_attachment_image_attributes','generate_custom_image_attributes');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment