[WordPress] 外掛分享: Lazyload, Preload, and More!

WordPress 外掛 Lazyload, Preload, and More! 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Lazyload, Preload, and More!」是 2023-05-02 上架。
  • 目前有 90 個安裝啟用數。
  • 上一次更新是 2023-10-09,距離現在已有 577 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 5.8 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 7.4 以上。
  • 有 1 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

aryadhiratara | thinkdigitalway |

外掛標籤

lazyload | lazy load | pagespeed | loading eager | core web vitals |

內容簡介

這是一款簡易又輕量化的 WordPress 外掛,能夠滿足 Google PageSpeed Insights、 Lighthouse 和網站的整體使用者體驗。這個外掛能自動將頁面中未顯示的圖片、iframe 或影片進行懶載入 (lazyload)、預載首頁、內頁、產品頁等常見頁面的特色圖片,並將無需懶載入的圖片或有特定標籤的圖片加上 loading=”eager”。使用者可以使用篩選器來自訂某些預設設定,並且這個外掛是 Optimize More! – Images 的簡化版,如果使用者想使用 UI 來進一步控制設定,可以試試這個外掛。

問題與答案:

1. 這個 WordPress 外掛有哪些功能?

- 自動應用懶載入 (lazyload)、預載特定圖片、並加上 loading=”eager” 屬性。
- 支援懶載入的內容包括圖片、iframe 和影片,還有 CSS 背景圖片。
- 提供篩選器供使用者自訂部分預設設定。

2. 什麼是 Lazysizes?

Lazysizes 是一個高效能的懶載入 library,由 Alexander Farkas 用純 JavaScript 撰寫,並沒有其他的依賴關係。這個 library 檢測到基於使用者互動、CSS 或 JavaScript 觸發的任何可見度變化,並提供高度的效能與 SEO 友善的懶載入功能。

3. 這個 WordPress 外掛的篩選器提供哪些設定?

- lpam_extra_exclude_list: 提供自訂懶載入排除清單。
- lpam_lazysizes_js_before: 更改 Lazysizes 設定。
- lpam_preload_featured_images_image_size: 更改預載首頁或內頁的特色圖片大小。

4. 這個 WordPress 外掛有哪些特別需要注意的事項?

- 這個外掛只在啟用後自動運作,且不會對網站的資料庫進行修改。
- 如果需要進一步控制設定,可以使用 Optimize More! – Images 這個外掛較為完整版。

原文外掛簡介

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

lazyload your below the fold images/iframes/videos,
preload your featured images (should also works well with WooCommerce product featured image),
add loading=”eager” to your featured image and all images that have no-lazy or skip-lazy class.
add missing image dimension to images that doesn’t have width and height attribute

Features

Lazy Load:

Images, iframes, and videos.
Inline background images.
CSS background image (simply put lazyload class to the background image container)

Preload Featured Images
Automatically preloading featured image from common page/post (homepage, pages except homepage, single post, and WooCommerce single product pages)
Add loading=”eager” attribute to to your featured image and all images that have no-lazy or skip-lazy class.
Add missing image dimension to images that doesn’t have width and height attribute [since 1.0.3]

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

Lazy load feature are using Lazysizes library (around 3kb, gzipped and minified).
This plugin doesn’t add anything to your database since there’s no settings and options. Everything will automatically activated after you activate the plugin.
You can change some default settings using filter.
This plugin is the simplified version of Optimize More! – Images, if you don’t want to use filters and need to control the settings with UI, you can try that plugin instead of this one.

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:

Optimize More!: A Do It Yourself WordPress Optimization Plugin that give you the ability to:

Load CSS Asynchronously – selectively load CSS file(s) asynchronously on selected post/page types.

Delay CSS and JS until User Interaction – selectively delay CSS/JS load until user interaction on selected post/page types.

Preload Critical CSS, JS, and Font Files – selectively preload critical CSS/JS/Font file(s) on selected post/page types.

Remove Unused CSS and JS Files – selectively remove unused CSS/JS file(s) on selected post/page types.

Defer JS – selectively defer loading JavaScript file(s) on selected post/page types.

Advance Defer JS – hold JavaScripts load until everything else has been loaded. Adapted from the legendary varvy’s defer js method *recommended for defer loading 3rd party scripts like ads, pixels, and trackers

Load Gutenberg CSS conditionally

Remove Passive Listener Warnings

and many more

Other USEFUL PLUGIN:

Shop Extra – A lightweight plugin to optimize your WooCommerce & Business site that makes you able to:

add Floating WhatsApp Chat Widget (can be use without WooCommerce),
add WhatsApp Order Button for WooCommrece,
Hide/Disable WooCommerce Elements,
WooCommerce Strings Translations,
and many more.

Animate on Scroll – Animate any Elements on scroll using the popular AOS JS library simply by adding class names. This plugin helps you integrate easily with AOS JS library to add any AOS animations to WordPress. Simply add the desired AOS animation to your element class name with “aos-” prefix and the plugin will add the corresponding aos attribute to the element tag.

Optimize More!
Need to optimize more? Try my WordPress Page Speed Optimization’s Service.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Lazyload, Preload, and More!」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0.0 | 1.0.1 | 1.0.2 | 1.0.3 | 1.0.4 | trunk |

延伸相關外掛(你可能也想知道)

  • WP Fastest Cache 》han PNG or JPEG, which means faster downloads and less data consumption for your visitors, Database Cleanup – Detect and delete unnecessary d...。
  • Autoptimize 》Autoptimize 能夠輕鬆優化您的網站。它可以整合、縮小和快取腳本和樣式表,在默認情況下向頁面 head 中注入 CSS,但也可以內嵌關鍵 CSS 並延遲整合的完整 CSS...。
  • Speed Booster Pack ⚡ PageSpeed Optimization Suite 》「Speed Booster Pack」是一款WordPress外掛,它可以讓你的網站速度更快,讓你在Google PageSpeed、GTmetrix、Pingdom、WebPageTest等主要速度測試服務上得到...。
  • Cloudinary – Deliver Images and Videos at Scale 》t, you can sign up for a free account on the Cloudinary website. Once you have an account, you can install our WordPress plugin and start optimizin...。
  • RabbitLoader Cache: Optimize your Website for Speed 》RabbitLoader是一款基於CDN快取的速度優化外掛程式,利用快取、CDN和其他技術來縮短WordPress網站的加載時間,讓您在Google PageSpeed Insights中獲得完美的...。
  • BerqWP – Automated All-In-One PageSpeed Optimization for Core Web Vitals, Cache, CDN, Images, CSS, and JavaScript 》SearchPro 可以透過 WordPress Rest API,讓使用者輕鬆地找到相關內容。它可以從 WordPress 文章、頁面、WooCommerce 產品,甚至是自訂文章類型中的標題和內...。
  • Core Web Vitals & PageSpeed Booster 》Core Web Vitals是新的排名因素, Google宣布「Core Web Vitals」將成為網站重要的排名因素。實際上,Core Web Vitals或頁面體驗信號將成為網頁在Google的Top ...。
  • Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution 》總結:, Solid Performance 外掛能快速提升網站速度和效能,安裝啟用後可立即創建靜態版本的網址,加快效能。, , 問題與答案:, 1. Solid Performance 如何提...。
  • Fast WP Speed 》化提升網站速度的策略被稱為速度優化。毫無疑問,網站速度是確保用戶體驗的關鍵因素之一。沒有人喜歡緩慢的網站,甚至搜索引擎也會因為降低搜索排名而懲罰加...。
  • AccessibilityPlus: Boost Accessibility & SEO Score for Lighthouse 》這是一個 WordPress 外掛,可通過修正推薦功能來提高您的網站頁面速度、可用性和 SEO 分數。此外掛處理的問題包括:, , 表單元素沒有相關聯的標籤, 連結沒有...。
  • Optimize More! 》這是一個「自助」WordPress頁面速度優化套件。, 控制您的CSS和JS交付:異步載入CSS,延遲CSS和JS直到用戶互動,刪除未使用的CSS和JS文件,預加載關鍵CSS和JS...。
  • WP Google Core Web Vitals Fix 》請注意,WordPress 有著超過 100,000 種不同的主題和外掛,因此不可能創建一個自動化的解決方案,可以優化所有的外掛和主題。Google Core Web Vital 優化需要...。
  • Core Web Vitals Booster 》此外掛僅支援在 https://nestify.io 上托管的 WordPress 網站。您可以在 https://nestify.io 註冊免費試用訂閱。Speedien 可自動優化您的網站以獲得最佳的桌...。
  • Site Speed Test – SpeedGuard 》在您的WordPress控制台中,Google PageSpeed Insights即時顯示。, 它是免費的。, 每天測試網站速度表現,如果速度變慢,獲得詳細報告並通知您。, , 使用Speed...。
  • Oxyplug Prefetch & Prerender 》, 在文章/產品類別頁面上,使用者點擊前會先預載前 X 項。X 的預設值為 4 項,您可以透過外掛設定進行調整。, 如果使用者將滑鼠游標停留在某個連結上 X ...。

文章
Filter
Apply Filters
Mastodon