Linux 软件免费装
Banner图

Lazyload, Preload, and More!

开发者 aryadhiratara
thinkdigitalway
更新时间 2023年10月9日 10:34
PHP版本: 7.4 及以上
WordPress版本: 6.3
版权: GPLv2 or later
版权网址: 版权信息

标签

performance video image woocommerce lazyload iframe lazy load pagespeed core web vitals preload web vitals loading eager

下载

1.0.2 1.0.1 1.0.0 1.0.3 1.0.4

详情介绍:

A drop dead simple and lightweight image, iframe, and video optimization plugin to satisfy Google PageSpeed Insights, Lighthouse, and overall user experience. This tiny little plugin (around 14kb zipped) will automatically Features Should works well with all page builders and theme builders. This plugin also able to lazy loading WooCommerce images and preloading WooCommerce product featured images. Disclaimer About Lazysizes Lazysizes is highly performant lazy load library, written by Alexander Farkas in pure JS with no dependencies. Taken from lazysize's github description: High performance and SEO friendly lazy loader for images (responsive and normal), iframes and more, that detects any visibility changes triggered through user interaction, CSS or JavaScript without configuration. Filters Example filter to add extra lazyload exclude list: add_filter( 'lpam_extra_exclude_list', function($lpam_extra_exclude_list) { return array( 'my-logo', 'my-hero-img', 'exclude-lazy' ); } ); Example filter to change lazysizes config (Read the docs): add_filter( 'lpam_lazysizes_js_before', function($lpam_lazysizes_js_before) { return 'window.lazySizesConfig = { expand: 500, threshold: 500 };' } ); Example filter to change the image sizes for preload featured image: add_filter( 'lpam_preload_featured_images_image_size', function($image_size, $post) { if ( is_singular( 'post' ) ) { return 'large'; } elseif ( is_singular( 'product' ) ) { return 'full'; } else { return $image_size; } }, 10, 2 ); [new since 1.0.2] Example to disable the preload featured image feature in certain page-type: add_filter('disable_featured_image_preload', function ($disable) { if ( is_singular( 'post' ) ) { return true; } }); [new since 1.0.3] Example to disable adding image dimension in certain page-type: add_filter('disable_img_dimension', function ($disable) { if ( is_singular( 'post' ) ) { return true; } }); [new since 1.0.3] Example to disable this plugin completely in certain page using url: add_filter('lazy_load_excluded_pages', function ($excludedPages) { $excludedPages[] = '/page-1'; $excludedPages[] = '/page-2'; return $excludedPages; }); [new since 1.0.3] Example to disable this plugin completely in certain page using page ID: add_filter('lazy_load_excluded_page_ids', function ($excludedPageIDs) { $excludedPageIDs[] = 3678; // Exclude page with ID 1 $excludedPageIDs[] = 3615; // Exclude page with ID 2 return $excludedPageIDs; }); [new since 1.0.4] To disable the tag: add_filter('disable_noscript', '__return_true');   USEFUL PLUGINS TO OPTIMIZE YOUR SITE'S SPEED: Other USEFUL PLUGIN: Optimize More! Need to optimize more? Try my WordPress Page Speed Optimization's Service.

安装:

From within WordPress
  1. Visit Plugins > Add New
  2. Search for Lazyload, Preload, and more!
  3. Activate Lazyload, Preload, and more! from your Plugins page
Manually
  1. Download the plugin using the download link in this WordPress plugins repository
  2. Upload lazyload-preload-and-more folder to your /wp-content/plugins/ directory
  3. Activate Lazyload, Preload, and more! plugin from your Plugins page

常见问题:

How to enable lazy loading CSS background images?

Lazy loading css background images requires some effort from your end. Add an extra lazyload class to each container which has css background image in your favorite page editor.

Preload featured images not working?

It calls images set as featured image in the native WordPress post/pages, using get_post_thumbnail_id() and wp_get_attachment_image_src(). Make sure you already adds them. If you are using Elementor or other Page's builders, simply edit the pages with the native WordPress editor to set the featured image.

This plugin preload the wrong image size in my post?

By default, this plugin will be grab the url and preload the full image size and woocommerce_single for WooCommerce single product pages. You can change that using filter if your theme is uses different image size. See example plugin description.

更新日志:

1.0.4 1.0.3 1.0.2 1.0.1 1.0.0