[WordPress] 外掛分享: EC Lightbox

首頁外掛目錄 › EC Lightbox
全新外掛
安裝啟用
尚無評分
56 天前
最後更新
問題解決
WordPress 6.7+ PHP 7.4+ v1.1.0 上架:2026-01-19

內容簡介

**總結:**
EC Lightbox 是一個簡約的 WordPress 外掛,使用 GLightbox 在圖庫中添加一個現代化的燈箱效果。它通過自定義 CSS 類的啟動行為,只在特定塊中應用它的燈箱功能。

**問題與答案:**
1. EC Lightbox 的啟動行為是如何工作的?
- 啟動行為是選擇性的。啟動後,它僅在添加自定義 CSS 類(例如 Gallery block)的塊中應用燈箱功能,其他地方 WordPress 保持正常運作。

2. 如何在 Gallery block 上啟用 EC Lightbox?
- 插入一個 Gallery block。
- 選擇 Gallery block 本身而不是其中的單個圖像。
- 在塊側欄中進行配置:Link to → None, Disable “Open in lightbox” / “Enlarge on click”。
- 開啟進階面板。
- 添加以下類:ec-lightbox。
- 更新或發佈帖子。

3. EC Lightbox 的設定頁面在哪裡?有哪些可用選項?
- 設定頁面位於:Settings → EC Lightbox。
- 可用選項包括:Loop images、Enable touch navigation、Enable zoom、Autoplay videos(為未來視頻支援)。

4. 如何以程式方式修改 GLightbox 選項?
- 通過添加過濾器 `ec_lightbox_js_options`,可以在程式中修改 GLightbox 選項。
- 在過濾器中可以設置不同的選項,例如設定循環、縮放和打開效果等。

外掛標籤

開發者團隊

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

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「EC Lightbox」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

EC Lightbox is a minimal WordPress plugin that adds a modern lightbox to galleries using GLightbox.
The plugin is opt-in by behavior: once activated, it only applies its lightbox functionality to blocks where you explicitly add a custom CSS class (for example, a Gallery block). Everywhere else, WordPress behaves normally.
Features

Uses GLightbox for a clean, responsive lightbox.
Works with WordPress core blocks (e.g. Gallery, Image).
Opt-in activation via a custom CSS class (ec-lightbox).
Groups images by gallery container (each block with ec-lightbox is its own gallery).
Includes a Settings page in WordPress Admin.
Configurable behavior: loop, touch navigation, zoom.
Local vendor assets by default (no hard dependency on external CDNs).

Requirements

WordPress 5.0+
PHP 7.0+
A block-based setup (Gutenberg) is recommended.

How to enable EC Lightbox on a Gallery block

Insert a Gallery block.
Select the Gallery block itself (not a single image inside it).
In the block sidebar, configure:

Link to → None
Disable “Open in lightbox” / “Enlarge on click” if present.

Open the Advanced panel.

Add the following class:
ec-lightbox

Update or publish the post.

When users click an image inside that gallery, EC Lightbox will open and allow navigation through the gallery.
Note:
Make sure individual images inside the gallery do not have click settings assigned.
If these WP-native actions remain enabled, WordPress will attach its own click/lightbox behavior, overriding this plugin.
⚙️ Settings Page (WordPress Admin)
A configuration screen is available at:
Settings → EC Lightbox
Available options:

Loop images
Enable touch navigation
Enable zoom
Autoplay videos (for future video support)

All settings are passed directly to the lightbox JavaScript on initialization.
🧩 Filters & Developer API
1. Modify GLightbox options programmatically
`php

add_filter( ‘ec_lightbox_js_options’, function ( $options ) {
$options[‘loop’] = true;
$options[‘zoomable’] = false;
$options[‘openEffect’] = ‘zoom’; // Any GLightbox option is accepted
return $options;
});
`
Options merged from:
1. Plugin defaults
2. Admin settings
3. This filter (highest priority)

延伸相關外掛

文章
Filter
Apply Filters
Mastodon