Switching to Swipebox in Post Gallery Plugin
When we first released the plugin, back in 2016, we made the decision to include Lightbox2 as its built-in light-box solution to display the high resolution version of the media; and while it has done its job, Lightbox2 is a 8 years old jquery plugin that has been feeling dated in comparison to the newest light-box solutions that have appeared in recent years (specially if we take in consideration its lack of video support).
Because we have implemented video support in “Post Gallery” version 2.1.0 (in wordpress) and that many of our users have requested us to consider different light-box alternative, is that we have decided to switch to Swipebox.
We have been reviewing the latest, most popular and used light-box solutions, and we have finally picked Swipebox as the replacement of Lightbox2 in Post Gallery because of various reasons:
- Its HTML implementation is very similar.
- Its code looks optimized and simple, making it run fast on browsers.
- Supports video (YouTube and Vimeo).
- It is mobile friendly.
Here is a small example:
Although we won’t be removing Lightbox2 entirely yet, since we know that many of our users use it and have implemented customizations and we want to provide backwards compatibility for a considerable period of time so they can make the proper changes on their side as well.
Do you want to keep Lightbox2?
The following steps will help our users to make the proper changes on their end for if they wish to maintain Lightbox2 as their go-to light-box solution, this changes should be done on their theme, not on the plugin itself (because otherwise this changes will be overridden on future releases of the plugin):
Disable Post Gallery’s enqueue by heading to WordPress Dashboard > Galleries and unchecking the “Enqueue assets” option.
You will need to enqueue into wordpress lightbox, the following hook action will do the trick:
Customizing view file
Next, you will need to customized the gallery view template. To do this copy the file “simple-post-gallery/assets/views/plugins/post-gallery/gallery.php” from the plugin into your theme “theme/views/plugins/post-gallery/gallery.php” and make it look like this:
Is Swipebox the right choice?
Share your thoughts with us, write your opinion below and let us know if you think we did the right move or if we picked the right choice, we are eager to hear your feedback. In the meantime we are glad you like and are using our products. Cheers!