Skip to content

Instantly share code, notes, and snippets.

@wpsmith
Created October 5, 2012 18:33
Show Gist options
  • Select an option

  • Save wpsmith/3841563 to your computer and use it in GitHub Desktop.

Select an option

Save wpsmith/3841563 to your computer and use it in GitHub Desktop.
Add Lazy Load to Genesis Get Image
add_filter( 'lazyload_images_placeholder_image', 'wps_lazyload_placeholder_image' );
/**
* Filter the default image src/URL.
*
* @param $image string Default Image URL/src.
* @return string New default Image URL/src.
*/
function wps_lazyload_placeholder_image( $image ) {
return 'http://url/to/image';
}
add_filter( 'genesis_get_image', 'wps_get_image_lazy' );
/**
* Filter the output to add lazyload_images_add_placeholders() helper function.
*
* @param $output string HTML markup of the image.
* @return string Modified HTML markup for lazyload use.
*/
function wps_get_image_lazy( $output ) {
return lazyload_images_add_placeholders( $output );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment