Created
October 5, 2012 18:33
-
-
Save wpsmith/3841563 to your computer and use it in GitHub Desktop.
Add Lazy Load to Genesis Get Image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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