lazy-images.php
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Module Name: Lazy Images |
| 5 | * Module Description: Speed up your site and create a smoother viewing experience by loading images as visitors scroll down the screen, instead of all at once. |
| 6 | * Jumpstart Description: Lazy-loading images improve your site's speed and create a smoother viewing experience. Images will load as visitors scroll down the screen, instead of all at once. |
| 7 | * Sort Order: 24 |
| 8 | * Recommendation Order: 14 |
| 9 | * First Introduced: 5.6.0 |
| 10 | * Requires Connection: No |
| 11 | * Auto Activate: No |
| 12 | * Module Tags: Appearance, Recommended |
| 13 | * Feature: Appearance, Jumpstart |
| 14 | * Additional Search Queries: mobile, theme, fast images, fast image, image, lazy, lazy load, lazyload, images, lazy images, thumbnail, image lazy load, lazy loading, load, loading |
| 15 | */ |
| 16 | |
| 17 | /** |
| 18 | * This module relies heavily upon the Lazy Load plugin which was worked on by |
| 19 | * Mohammad Jangda (batmoo), the WordPress.com VIP team, the TechCrunch 2011 |
| 20 | * redesign team, and Jake Goldman of 10up LLC. |
| 21 | * |
| 22 | * The JavaScript has been updated to rely on InterSection observer instead of |
| 23 | * jQuery Sonar. Many thanks to Dean Hume (deanhume) and his example: |
| 24 | * https://github.com/deanhume/lazy-observer-load |
| 25 | */ |
| 26 | |
| 27 | require_once( JETPACK__PLUGIN_DIR . 'modules/lazy-images/lazy-images.php' ); |
| 28 | |
| 29 | /* |
| 30 | * Initialize lazy images on the wp action so that conditional |
| 31 | * tags are safe to use. |
| 32 | * |
| 33 | * As an example, this is important if a theme wants to disable lazy images except |
| 34 | * on single posts, pages, or attachments by short-circuiting lazy images when |
| 35 | * is_singular() returns false. |
| 36 | * |
| 37 | * See: https://github.com/Automattic/jetpack/issues/8888 |
| 38 | */ |
| 39 | |
| 40 | add_action( 'wp', array( 'Jetpack_Lazy_Images', 'instance' ) ); |
| 41 |