=== Easy Justified Gallery - Photo Gallery Block with Lightbox === Contributors: imyuvii Donate link: https://www.paypal.me/imyuvii Author URI: http://imyuvii.com/ Plugin URI: http://imyuvii.com/ Tags: justified, gallery block, photo gallery, image gallery, lightbox Requires at least: 6.5 Tested up to: 7.1 Stable tag: 2.0.0 Requires PHP: 7.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html The fastest justified photo gallery for WordPress. A gallery block, unlimited galleries, a modern lightbox, and no jQuery. == Description == Easy Justified Gallery is a responsive photo gallery that lays your images out in tidy, full width rows without cropping them, the way photo sites do it. It does that one thing and nothing else. No upsells, no ads, no dashboard banners, no tracking. **Fast by design** The whole front end is 7.5 KB of JavaScript and CSS, and none of it is jQuery. Rows are worked out from the image dimensions WordPress already stores, so the layout is correct before a single image has downloaded and nothing jumps around as they arrive. Images load lazily, at the size they are actually displayed, using the srcset WordPress generates. Assets load only on pages that really contain a gallery. A page without one downloads nothing at all, and a gallery that opens images in a new tab never downloads the lightbox. **Features** * A gallery block for the block editor, with a live preview of the real thing * As many galleries as you like, each with its own images and settings * Reuse one gallery on any number of pages. Edit it once, every page updates * Rows justified from image aspect ratios, never cropped, never distorted * Captions off, on hover, or always visible, taken from the media library caption and falling back to alt text * A modern lightbox with pinch zoom, swipe, and keyboard navigation * Per gallery row height and spacing, overridable per placement * No jQuery, no frameworks, no build artefacts you did not ask for * Works with the block editor, the classic editor, widgets, and `do_shortcode()` **Blocks or shortcodes, your choice** Add the "Justified Gallery" block and pick a saved gallery, or choose images right inside the block. Prefer shortcodes? `[easyGallery id="123"]` renders a specific gallery and plain `[easyGallery]` still works exactly as it did in 1.x. == Installation == 1. Install the plugin through the WordPress plugins screen, or upload the files to `/wp-content/plugins/easy-justified-gallery`. 2. Activate it through the *Plugins* screen. 3. Go to *Galleries > Add Gallery*, give it a name, and choose your images. 4. Add the *Justified Gallery* block to a page, or paste the shortcode shown on the gallery edit screen. Upgrading from 1.x? Your existing gallery and its settings are moved into a gallery called "My Gallery" automatically the first time the new version loads. Any `[easyGallery]` shortcodes already in your content keep rendering it, so there is nothing to do. == Frequently Asked Questions == = How do I add a gallery to a page? = In the block editor, add the *Justified Gallery* block and pick your gallery in the block settings. Anywhere else, paste the shortcode from the gallery edit screen, for example `[easyGallery id="123"]`. = I upgraded from 1.x. Where did my gallery go? = It is under *Galleries*, called "My Gallery", with the same images, row height, spacing and caption setting it had before. Existing `[easyGallery]` shortcodes render it without any change, because a shortcode with no `id` always renders the migrated gallery. = Can I use more than one gallery? = Yes, as many as you want. Each gallery gets its own shortcode, and the block can point at any of them. The same gallery can appear on any number of pages, and editing it updates all of them at once. = Can one gallery look different on different pages? = Yes. In the block, turn off *Use the gallery's own layout* and set the row height, spacing, captions and click behaviour for that placement. The saved gallery is left alone. = Does it really not use jQuery? = Not on the front end. The layout is plain JavaScript and the lightbox is GLightbox, neither of which needs jQuery. The image picker on the gallery edit screen uses the jQuery that WordPress already loads in the admin, which never reaches your visitors. = How do I add captions? = Set the caption field on an image in the media library, then choose *Show on hover* or *Always visible* under Captions. Images without a caption fall back to their alt text, and images with neither are simply shown without one. = How do I use a gallery in a theme template? = `` = What happened to Settings > EJ Gallery? = It is gone. Galleries are now real content with their own admin screens, so everything lives under *Galleries* instead. Your old settings were migrated across before the screen was removed. == Screenshots == 1. A justified gallery on the front end. Rows are filled edge to edge and no image is cropped to get there. 2. The Justified Gallery block, previewing the real layout inside the editor. 3. Building a gallery: pick the images, drag to reorder, set the layout, copy the shortcode. 4. Choosing images from the WordPress media library. 5. All your galleries in one list, each with the shortcode to place it. 6. The lightbox, with zoom, swipe and keyboard navigation. == Changelog == = 2.0.0 = Release Date: August 19, 2026 The plugin has been rewritten. It is smaller, faster, and no longer carries a settings framework. * NEW: A "Justified Gallery" block for the block editor, previewing the real layout rather than an approximation of it. * NEW: Unlimited galleries. Galleries are now managed under their own *Galleries* menu, each with its own images and settings, and each reusable on any number of pages. * NEW: `[easyGallery id="123"]` renders a specific gallery. Plain `[easyGallery]` keeps rendering the gallery your 1.x settings were migrated into. * NEW: Caption modes: off, on hover, or always visible. Captions come from the media library caption field and fall back to alt text. * NEW: The block can lay a shared gallery out differently on one page without touching the saved gallery. * NEW: The gallery screen warns when captions are switched on but the chosen images have no caption text, instead of silently showing nothing. * ENHANCED: The front end no longer uses jQuery at all. The jQuery justified gallery library and Colorbox have been replaced with roughly 8 KB of plain JavaScript and CSS. * ENHANCED: Rows are calculated from the image dimensions WordPress already stores, so the layout is right before any image loads and nothing reflows as they arrive. * ENHANCED: The lightbox is now GLightbox, with pinch zoom, swipe, and keyboard navigation. It is only downloaded on pages holding a gallery that uses it. * ENHANCED: Images are served through `wp_get_attachment_image()` with a correct `sizes` hint, so browsers download a thumbnail scaled to the space it fills rather than a full size file. * ENHANCED: Native lazy loading and asynchronous decoding on every gallery image. * ENHANCED: Without JavaScript, or before it runs, the gallery is laid out with CSS instead of collapsing into a column. * ENHANCED: Respects `prefers-reduced-motion`, and gallery images are keyboard focusable. * ENHANCED: Removed the bundled Carbon Fields library. The plugin is 25 files and 159 KB, down from 574 files and 10 MB, because it no longer ships a settings framework it barely used. * CHANGED: Settings moved from *Settings > EJ Gallery* to the *Galleries* menu. Existing settings, including those from the pre-1.1 releases, are migrated automatically and the old options are left untouched. * CHANGED: Requires WordPress 6.5 or newer. * FIXED: The "gallery is empty" placeholder is no longer shown to visitors, only to users who can do something about it. * FIXED: Clicking a gallery image in the block editor no longer navigates the editor canvas to the image file. = 1.0.0 = Release Date: November 11, 2016 * Initial Commit = 1.0.1 = Release Date: November 13, 2016 * NEW: WordPress media browser * NEW: Manual image slide show in popup * ENHANCED: On hover effect = 1.0.2 = Release Date: November 14, 2016 * FIXED: Fixes 4.3.1 css/js path issue * ENHANCED: included files via plugins_url() method = 1.0.3 = Release Date: November 14, 2016 * ENHANCED: Optimized options json string, removed unused data = 1.0.4 = Release Date: November 29, 2016 * ENHANCED: Revamped settings page * ENHANCED: Image preview of selected images in gallery settings. * ENHANCED: Rewritten entire settings panel, it is now robust and more scalable for upcoming releases. = 1.0.5 = Release Date: December 2, 2016 * FIXED: Image caption supports on and above WordPress 4.6.0 = 1.0.6 = Release Date: December 2, 2016 * FIXED: Compatibility with WP 4.7 = 1.0.7 = Release Date: April 13, 2017 * ENHANCED: Re-branding plugin, preparing for new releases this year. = 1.0.8 = Release Date: May 23, 2018 * ENHANCED: Changed the way dummy images were uploaded. = 1.0.9 = Release Date: Nov 28, 2022 * ENHANCED: Security updates. * ENHANCED: Admin option titles * ENHANCED: It will use jQuery if it's not installed = 1.1 = Release Date: Dec 03, 2022 * ENHANCED: Followed up on all the WordPress security standards = 1.1.1 = Release Date: Dec 06, 2022 * ENHANCED: removed deprecated libraries = 1.2.0 = Release Date: August 18, 2026 * NEW: Tested and confirmed compatible with WordPress 7.1 and PHP 8.5. * FIXED: Gallery assets are now registered on `init`, so the shortcode works reliably in block themes (block themes render post content before `wp_enqueue_scripts` runs). * FIXED: The `Open image in > New Tab` option produced a broken anchor because the whole attribute was escaped as a value. * FIXED: The "no images selected" notice printed its text in the wrong place. * FIXED: The Settings link on the plugins page pointed at the old settings screen. * FIXED: Several galleries on one page no longer share the same DOM id, so each one initialises and groups its own lightbox. * ENHANCED: Updated bundled Carbon Fields from 3.3.4 to 3.6.9, removing PHP 8.2-8.5 deprecation notices. * ENHANCED: Replaced deprecated jQuery APIs (`$.type`, `$.isFunction`, `.bind()`, `.click()`, `.live()`) in the bundled gallery and lightbox scripts. * ENHANCED: Captions are escaped before being rendered and are output server side. * ENHANCED: CSS and JS are only loaded on pages that actually contain the shortcode. * ENHANCED: Images now keep their own alt text; the caption is no longer forced into the alt attribute. * ENHANCED: The hover effect now works on every image. It used to be drawn by the caption element, so images without a caption had no hover state at all. * ENHANCED: Captions now sit in a bar along the bottom of the image instead of a panel covering the whole image, and they fade in properly. * FIXED: "Requires at least" now states 4.7, the oldest version the plugin actually works on. The previously declared 4.0 was never accurate, the bundled settings library needs the REST API added in 4.7. * FIXED: Settings saved by the pre-1.1 releases are now recovered automatically on update, including settings mangled by the old activation routine. Deactivating and reactivating the plugin is no longer needed. == Upgrade Notice == = 2.0.0 = A full rewrite: a block editor block, unlimited galleries, no jQuery, and a 10 MB bundled library removed. Your existing gallery and shortcodes are migrated automatically. = 1.2.0 = Compatibility release for WordPress 7.1 and PHP 8.5. Recommended for everyone. = 1.0.5 = Minor bug fixes, Mandatory for WordPress 4.5 Version or below. = 1.1.1 = Mandatory security updates.