Linux 软件免费装
Banner图

FancyBox for WordPress

开发者 silkalns
更新时间 2026年11月9日 19:37
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv3 or later
版权网址: 版权信息

标签

photos lightbox images pictures fancybox

下载

1.0 1.0.2 1.1 1.2 1.3 2.0 2.1 2.1.1 2.2 2.5 3.0.0 3.0.3 3.0.4 3.0.7 3.1.1 3.4.0 3.4.1 3.4.2 3.4.3 2.5.1 2.6.0 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 3.0.1 3.0.10 3.0.14 3.0.2 3.0.5 3.0.6 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7

详情介绍:

FancyBox for WordPress turns the images you already have into a lightbox gallery. Activate it and every image that links to a full-size file opens in an overlay instead of loading a new page — in posts, pages, widgets and the block editor's gallery blocks, with no shortcodes and nothing to add to your content. If the defaults suit you, there is nothing to configure. What you get out of the box What you can change Settings live under Settings → Fancybox for WP, split into Appearance, Animations, Behaviour, Galleries and Misc: Built on FancyBox 3 The plugin bundles FancyBox 3.5.7. Nothing is loaded from an external CDN, so no visitor data leaves your site. The bundled copy is namespaced (fancyboxforwp) so it will not collide with a FancyBox that your theme or another plugin already loads. Translations Available in your language through WordPress.org language packs. Translations are contributed by the community at translate.wordpress.org — help for your locale is very welcome. Contributing Development happens on GitHub. Bug reports and pull requests are welcome. This plugin is developed and maintained by Colorlib, who also make free WordPress themes. If it is useful to you, a review genuinely helps.

安装:

  1. Upload the fancybox-for-wordpress folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. That's it, FancyBox will be automatically applied to all your image links and galleries.
  4. If you want to customize a bit the look and feel of FancyBox, go to the Options Page under General Options in the WordPress Admin panel

屏幕截图:

  • Appearance settings — overlay, padding, border, caption position and colours.
  • Gallery settings — group every image on the page, each gallery block, each post, or write your own expression.
  • Behaviour settings — closing, zoom, mouse wheel, WooCommerce, PDFs and mobile.

升级注意事项:

3.4.3 Security release. Fixes a stored cross-site scripting issue and a page-freezing bug that could both be triggered through a link in a comment. Update as soon as possible. 3.4.2 Fixes a conflict that could make the lightbox show a thin sliver instead of your image, or play a video with no picture, when another plugin or theme also loads FancyBox. Also a rewritten description, a real FAQ and new screenshots. 3.4.1 Fixes the Title size setting, removes the browser tooltip that appeared when hovering a thumbnail, and makes the lightbox pick up images added by infinite scroll or lazy loading. 3.4.0 Security and PHP 8 release. Note that three settings which previously had no effect now work as labelled - Overlay, Title and Zoom On Click - so if you had any of them switched off, your lightbox will change. Translations also start working for the first time. 3.0.5 Fixes the Revert options button and wrong version number on settings page. Also updates links in settings page and readme file.

常见问题:

How do I add a caption?

Three ways, and they stack:

  • Set the image's Title in the media library or block settings — it appears under the image.
  • Add a caption in the block editor — it is picked up automatically.
  • Add data-caption to the link for longer or formatted text:
<a href="big.jpg" data-caption="Marble, 2019<br>120 × 60 cm"><img src="thumb.jpg"></a> Basic HTML such as <br>, <em> and <a> is allowed. Captions are sanitised before display, so scripts and event handlers are stripped.

How do I stop one image opening in the lightbox?

Add class="nolightbox" to the link. Links from Envira Gallery and NextGen Gallery are skipped automatically so the two lightboxes do not fight.

The lightbox looks wrong — the image is cut off, stretched, or barely visible

Almost always another plugin or theme loading its own copy of FancyBox. Two stylesheets defining the same class names will fight, because FancyBox's CSS class names are shared. To check, open your browser's developer tools, look at the Network tab, and search for fancybox. If you see a .css file from anywhere other than /plugins/fancybox-for-wordpress/, that is the conflict. Disabling the other lightbox, or the option in your theme that loads it, resolves it. 3.4.2 fixed the worst version of this, where the image collapsed to a thin sliver and videos played sound with no picture.

Images loaded by infinite scroll or lazy loading do not open

Fixed in 3.4.1. Thumbnails added after the page has finished loading — infinite scroll, lazy loading, AJAX filters — are now detected and bound automatically. Update if you are on an older version.

Can I load the lightbox only on certain pages?

Yes, with a filter. Put this in your theme's functions.php or a site-specific plugin: add_filter( 'mfbfw_is_enabled', function ( $enabled ) { return is_page( array( 'portfolio', 'gallery' ) ); } ); Returning false means nothing loads at all — no CSS, no JavaScript. There are also built-in switches for mobile, WooCommerce shop pages and product pages under Behaviour.

PDFs open in the lightbox. How do I stop that?

Turn on Exclude PDF files under Behaviour and PDF links will open normally. Note that iOS Safari cannot display a PDF inside an overlay at all. If your visitors are mostly on iPhones or iPads, excluding PDFs is the more reliable choice.

How do I group images into galleries?

Under Galleries, choose how links are grouped:

  • All images on the page — one gallery for everything (default)
  • Each gallery block — one gallery per block editor gallery
  • Each post — one gallery per post on archive pages
  • No galleries — every image opens on its own
  • Custom expression — write your own jQuery selector

Does it work with WooCommerce, Elementor or other page builders?

WooCommerce has its own product image zoom, so there are switches under Behaviour to turn the lightbox off on shop and product pages. Page builders vary. The plugin looks for links pointing at an image file, so builders that output normal image links work. Builders that render their own lightbox usually need theirs disabled first.

Is it available in my language?

Translations come from WordPress.org language packs and install automatically. If your language is missing or incomplete, you can help at translate.wordpress.org.

Will it slow my site down?

It adds roughly 82 KB of minified JavaScript and 14 KB of CSS. Nothing is loaded from an external server. Define SCRIPT_DEBUG in wp-config.php if you need the unminified sources for debugging. If you only need the lightbox on a few pages, the mfbfw_is_enabled filter above avoids loading anything elsewhere.

Where do I report a bug?

The support forum or GitHub. A link to a page showing the problem makes it far quicker to diagnose.

更新日志:

3.4.3 Security: Fixed a stored cross-site scripting issue (CVE-2026-96571) where a crafted link in a comment could run script when opened in the lightbox. Video source, format and poster values are now escaped. Thanks to Yuto Hyakumoto and Wordfence for the responsible report. Security: Fixed a crafted link that could freeze the browser of everyone who loaded the page. Security: Hardened every other place the lightbox reads from a link. Thumbnail strips are built without HTML strings, unsafe URL schemes such as javascript: are refused, and HTML or Ajax content opened from a link is sanitized. Security: Captions and HTML opened from a link can no longer contain styles or form fields. Security: The custom JavaScript settings now require the unfiltered_html capability, so a site administrator on multisite can no longer change them or switch them on. Security: A URL can no longer open another site's page in the lightbox without a click. Security: Updated DOMPurify to 3.4.17. Changed: Links can now set only a fixed list of per-link options through data-* attributes: type, source, caption, thumbnail, size and on/off switches. Options that accept templates or markup must be passed through the JavaScript API. Changed: Smilies, emoji and comment avatars no longer open the lightbox. Changed: The plugin's inline CSS and JavaScript are now added through WordPress's script and style queues. Code that removed the mfbfw_init action should use the mfbfw_is_enabled filter instead. Fixed: With "load at footer" on and jQuery also in the footer, the lightbox did not start. Tested with WordPress 7.1. 3.4.2 Fixed: The lightbox could collapse to a thin sliver instead of showing the image, and videos played sound with no picture. The plugin's stylesheet carried a height: auto !important rule that overrode the height FancyBox calculates for each slide. On its own it happened to work, but as soon as a second copy of FancyBox's CSS was on the page - any theme or plugin bundling its own - the content box collapsed to nothing. The rule was added in 3.2.5 for a problem that no longer exists, and has been removed. Changed: Rewrote the plugin description and replaced the FAQ, which had answered only a question about a 2015 security release. It now covers captions, excluding images, gallery grouping, loading the lightbox on selected pages, PDFs, page builders and diagnosing conflicts with other lightboxes. Changed: New screenshots, taken on WordPress 7.0. The previous ones were from 2016 and showed an interface that no longer exists. Changed: Screenshots are served from the plugin directory rather than bundled in the download, which cuts the download size by about two thirds. 3.4.1 Fixed: The Title size setting had no effect. With the title positioned Inside or Over - the two positions most sites use - the caption you actually see is drawn inside the image frame, while the font-size rule was applied to a different, hidden element. (#87) Fixed: Hovering a thumbnail showed a browser tooltip repeating the caption. The plugin copied each image's title onto its link so the lightbox could read it, and browsers render that as a tooltip. The text is now carried in a data attribute instead. A title you set yourself is left alone. (#84) Fixed: Images loaded after the page finished rendering - infinite scroll, lazy loading, AJAX filters - were never picked up by the lightbox. New thumbnails are now detected and bound automatically. (#25, #69) Fixed: With Zoom On Click enabled, releasing the mouse after panning a zoomed image counted as a click and zoomed it straight back out. (#105) Fixed: The lightbox announced itself to screen readers as an unnamed dialog. It now carries an accessible name and is marked as a modal. (#104) Fixed: Removed a dead demo link from the plugin description. (#85) 3.4.0 Fixed: Translations never loaded. The plugin declared Text Domain: mfbfw while its WordPress.org slug is fancybox-for-wordpress, and WordPress looks for language packs under the slug - so none of the community translations on translate.wordpress.org ever reached anyone. The text domain now matches the slug, which switches on the six existing language packs (es_CL, es_ES, es_VE, nl_NL, ru_RU, tr_TR) and every future one. 63 locales have translation work waiting on translate.wordpress.org. Changed: The bundled translations were migrated onto the current strings and renamed to the new domain. German, Japanese and Polish ship in the plugin because no language pack exists for them yet; Spanish and Turkish were dropped because their WordPress.org packs are more complete and take precedence anyway. Added: Translations now also ship as .l10n.php files, the faster format WordPress 6.5 and newer prefer, with the .mo files kept as a fallback. Added: Regenerated languages/fancybox-for-wordpress.pot from the current source - the old template was written in 2015 and had drifted badly. Security: Updated the bundled DOMPurify from 3.1.6 to 3.4.13, picking up the fix for the nesting-based mXSS bypass (CVE-2025-26791) in the sanitizer the plugin relies on for captions and titles. Security: Fixed a CSS injection in the generated stylesheet. Colour and size settings were escaped with esc_html(), which only blocks "<", so a value such as blue}body{display:none} could close its own declaration block and inject arbitrary site-wide CSS. Colours are now validated as hex and sizes as integers. Security: Fixed a potential JavaScript injection via the animation speed setting, which was written into the option object unquoted. Security: The options sanitizer is now an allow-list. It previously started from the raw submitted array, so any key it did not explicitly name was stored untouched. Security: Added ABSPATH guards to every PHP file, a capability check on the settings screen and the reset action, and an uninstall.php so settings are removed on delete (not only on deactivate) when that option is enabled. Security: Removed the jQuery UI stylesheet loaded from code.jquery.com. It is now bundled, which also stops leaking admin IP addresses to a third party. The bundled copy's references to jQuery UI theme images were removed - they only ever resolved on the CDN - so the settings screen no longer fires five 404s per load. Fixed: Missing text domain on four strings on the Support tab, and a missing translators comment, so they can now be translated. Fixed: PHP 8 compatibility. On the first page view after activation, and on any front-end request following an update, the settings array was used before it was populated, producing a wall of "Undefined array key" warnings, an "Automatic conversion of false to array" deprecation (a fatal error under PHP 9), and a fatal TypeError if the option row was not an array. Settings are now resolved and type-normalized through a single schema before use. Verified clean on PHP 8.5. Fixed: The settings migration only ran inside wp-admin, so a site whose first request after an update was a front-end hit rendered against an incomplete settings array. Fixed: The Overlay, Title and Zoom On Click toggles had no effect - they were tested with isset() alone, which is always true once the key exists. They now behave as labelled. Fixed: "Make a gallery for each Gutenberg gallery block" matched nothing on WordPress 5.9 and newer, where the gallery block renders as figure.wp-block-gallery rather than ul.wp-block-gallery. Fixed: Zoom On Click attached a new click handler on every slide without removing the previous one. Fixed: load_plugin_textdomain() was called with the deprecated second argument. Fixed: Script and style versions were hardcoded to "1.3.4", so browsers kept serving stale assets after a plugin update. Fixed: Malformed markup on the settings screen - the reset form was never closed. Fixed: Callback and custom-expression textareas were escaped with esc_attr()/wp_kses_post() instead of esc_textarea(). Fixed: Legacy border-radius and shadow settings from FancyBox 1.x era installs are no longer discarded the first time the settings are saved. Changed: Assets are now minified - the FancyBox script drops from 162 KB to 68 KB and the stylesheet from 18 KB to 14 KB. Define SCRIPT_DEBUG to load the readable sources. Changed: Removed 22 unused FancyBox 1.x image files from the plugin package. Changed: The unprefixed PLUGIN_NAME constant is no longer redefined if another plugin already declared it. Added: mfbfw_settings and mfbfw_is_enabled filters for customizing settings and disabling the lightbox per request. Deprecated: hexTorgba() - use mfbfw_hex_to_rgba() instead. The old function still works. 3.3.7 - 07.05.2025 Fixed: Issue with text domain loading too early (translations now load properly on the init hook) Fixed: Improved HTML sanitization in captions with DOMPurify to prevent XSS while preserving valid HTML formatting 3.3.6 - 02.05.2025 Fixed: Security issue - Fixed XSS vulnerability in caption and title handling 3.3.5 - 12.11.2024 Fixed: Security issue 3.3.4 - 22.03.2024 Fixed: Security issue 3.3.3 - 11.05.2021 Fixed : Issue with padding and border ( https://github.com/ColorlibHQ/fancybox-for-wordpress/issues/86 ) 3.3.2 - 05.03.2021 Changed: Upgrade Fancybox to latest version ( https://github.com/ColorlibHQ/fancybox-for-wordpress/issues/95 ) Fixed: Close button not showing up although option is enabled 3.3.1 Compatibility with jQuery 3.0 3.3.0 Fixed compatibility issue with WordPress 5.6 3.2.9 3.2.8 3.2.7 3.2.6 3.2.5 3.2.4 3.2.3 3.2.2 3.2.1 3.2.0 3.1.9 3.1.8 3.1.7 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.12 Fixed errors causes by WordPress SVN. 3.0.7 3.0.6 3.0.5 3.0.4 3.0.3 3.0.2 3.0.1 3.0.0 2.7.5 2.7.4 2.7.3 2.7.2 2.7.1 2.7.0 2.6.0 2.5.1 2.5 2.2 2.1.1 2.1 2.0 1.3 1.2 1.1