[WordPress] 外掛分享: WP Enable WebP

首頁外掛目錄 › WP Enable WebP
⚠ 此外掛已下架 — 不再更新維護,建議勿安裝。
6,000+
安裝啟用
★★★★
4.9/5 分(7 則評價)
2375 天前
最後更新
問題解決
WordPress 4.3+ v1.0 上架:2018-12-19

內容簡介

這是一個 WordPress 外掛程式,可以啟用 WebP 圖片上傳到媒體庫。

同時,外掛會在 body 標籤上新增一個類別,以便使用 CSS 選擇器,方便設定背景圖片。

例如:

selector {

background: url(‘images/example.jpg’);
}

body.supports-webp #selector {
background: url(‘images/example.webp’);
}

在範本檔案中使用函數 webpSupported(),以條件式顯示 WebP 圖片。

例如:
if (webpSupported()) :
這裡是 WebP 圖片
else:
這裡是其他後備格式的圖片
endif;

WP Enable WebP 的主要特色包括:

啟用 WebP 圖片上傳到媒體庫。
瀏覽器偵測,並在 body 標籤上新增一個類別,以指示瀏覽器是否支援 WebP 格式。
提供一個輔助函數,供主題範本檔案檢查瀏覽器是否支援 WebP 圖片格式。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「WP Enable WebP」→ 直接安裝(推薦)

原文外掛簡介

This WordPress Plugin for WebP image uploads enabled WebP image uploads into the media library.
It will also add a class to the body tag for CSS selectors. This is helpful for setting background images.
Example:
selector {
background: url(‘images/example.jpg’);
}
body.supports-webp #selector {
background: url(‘images/example.webp’);
}
Use the function webpSupported() in template files to conditionally show WebP images.
Example:
if (webpSupported()) :
WebP image here
else:
Image with other fallback format here
endif;
Major features in WP Enable WebP include:

Enabling WebP Image uploads into the media library.
Browser detection that adds a class to the body tag indicating WebP is supported by the browser.
Helper function to use in theme template files to check if the browser supports WebP image format.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon