jQuery(document).ready(function($) {
// Add class to thumbnails with sold tag
$('.ngg-gallery-thumbnail-box').each(function() {
if ($(this).find('.wp-tag-sold').length) {
$(this).find('.ngg-gallery-thumbnail').addClass('has-sold-tag');
}
});
// Initialize SimpleLightbox with custom options
var lightbox = new SimpleLightbox('.ngg-gallery-thumbnail-box a', {
fadeSpeed: 200,
animationSlide: true,
onShow: function() {
// Check if the clicked image has the sold tag
var currentElement = $('.sl-image');
var originalElement = $(this.element);
if (originalElement.closest('.ngg-gallery-thumbnail-box').find('.wp-tag-sold').length) {
// Add sold overlay to lightbox image
if (!currentElement.find('.sold-overlay').length) {
currentElement.append('