lazy-images.php 1.4 KB

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