diff --git a/src/js/lightbox.js b/src/js/lightbox.js index 352bb863..015addd3 100644 --- a/src/js/lightbox.js +++ b/src/js/lightbox.js @@ -63,6 +63,7 @@ Lightbox.prototype.init = function() { this.enable(); this.build(); + this.wordpress(); }; // Loop through anchors and areamaps looking for either data-lightbox attributes or rel attributes @@ -137,6 +138,20 @@ }); }; + // Lightbox to WordPress gallery + Lightbox.prototype.wordpress = function() { + if ($('meta[name=generator][content*=WordPress]').length === 1) { + $('.gallery').each(function () { + var id = $(this).attr('id'); + $(this).find('a').each(function () { + if ($(this).attr('href').indexOf('attachment_id') === -1) { + $(this).attr('data-lightbox', id); + } + }); + }); + } + }; + // Show overlay and lightbox. If the image is part of a set, add siblings to album array. Lightbox.prototype.start = function($link) { var self = this;