• Resolved Jon

    (@omanhene)


    Is there a way to disable Ultimate Lightbox for a Gallery? I see that I can enable/disable it for individual images using the Basic Options using a Class or Selector. This does work if I add a class to an image link itself, but am having trouble getting this to behave by adding a class to the gallery shortcode.
    I presume this is doable, is there more documentation or examples of how to effectively use those Class or Selector options for galleries?

    I prefer enable the lightbox for all images, and then disable a single Gallery using a shortcode, but if having the default as off, and enabling each image and gallery with a class/id/parameter is easier, I could do that too.

    Please advise

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Jon

    (@omanhene)

    Anyone have any ideas on this?
    Basically looking for a way of Disabling the lightbox at the Gallery level instead of the image level?

    Plugin Author Rustaurius

    (@rustaurius)

    Hi Jon,

    Do you have a link to the gallery you’re trying to disable?

    If you don’t mind editing the JavaScript file, it would definitely be possible to disable for a particular gallery, but I’d need to see what classes are currently applied to the gallery to be able to suggest a change.

    Adding a “skip selector” option could be an interesting feature idea for a future update as well.

    Thread Starter Jon

    (@omanhene)

    Having a “skip selector” in a gallery is a great idea. I can tell you I have looked at a few other lightbox plugins, and they do not have that option.

    Is there a way to just hardcode my own DIV or SPAN to wrap the gallery shortcode in that would have a class that would exlude lightboxing its output?

    There does already seem to be a built in version of this…but this class might be coming from my theme or another plugin – I don’t know how it got there? See the sample of my gallery shortcode output below…there is a DIV that wraps the gallery output. <div ID=”gallery-4″> is a unique value for each gallery. Is there a way to grab that and use it to exclude lightboxing all the images inside it? I’ll do a little more hunting later on to see where that is coming from, or if it is actually a default feature of the wordpress gallery shortcode.

    ( FYI – There is also a GalleryID value, but that does not work well, as some galleries, like the ones I am working with which use media_categories instead of image IDs, always set the GalleryID to zero and not unique value for each gallery.)

    EXAMPLE – using this shortcode: {gallery media_category=”12″} gives this output >>>>>

    `<div id=”gallery-4″ class=”gallery galleryid-0 gallery-columns-3 gallery-size-thumbnail”><dl class=”gallery-item”>
    <dt class=”gallery-icon landscape”>
    <a href=”https://dennispearsonbeasties.com/yard1-2/&#8221; class=”ewd-ulb-lightbox”><img width=”150″ height=”150″ src=”https://dennispearsonbeasties.com/wp-content/uploads/yard1-150×150.jpg&#8221; class=”attachment-thumbnail size-thumbnail” alt=”” aria-describedby=”gallery-4-938″ srcset=”https://dennispearsonbeasties.com/wp-content/uploads/yard1-150×150.jpg 150w, https://dennispearsonbeasties.com/wp-content/uploads/yard1-75×75.jpg 75w” sizes=”(max-width: 150px) 100vw, 150px”></a>
    </dt>
    <dd class=”wp-caption-text gallery-caption” id=”gallery-4-938″>
    Beasties in the yard </dd></dl><dl class=”gallery-item”>
    </div> `

    FYI – The media library categories I use are created by this plugin. This page might be helpful in understanding what it does, if that becomes important.
    https://wpuxsolutions.com/documents/enhanced-media-library/enhanced-media-shortcode-possible-conflicts

    Plugin Contributor etoilewebdesign

    (@etoilewebdesign)

    Hi Jon,

    Sorry for the late reply. I’m not sure how this thread slipped through, but I apologize.

    If you aren’t currently using the “Images with the Following CSS Selectors” option to include images, then one way for you to get the functionality you want would be to take the following section from the “ewd-ulb.js” file (which is in the “js” folder):

    
        if (jQuery.inArray("image_selector", add_lightbox_array) !== -1) {
            var selector_array = ewd_ulb_php_add_data.image_selector_list.split(',');
            jQuery(selector_array).each(function(index, el) {
                jQuery(el).each(function() {
                    if (jQuery(this).height() >= ewd_ulb_php_add_data.min_height && jQuery(this).width() >= ewd_ulb_php_add_data.min_width) {
                        jQuery(this).parent().addClass('ewd-ulb-lightbox');
                        jQuery(this).parent().data('ulbsource', jQuery(this).attr('src'));
                    }
                });
            });
        }
    

    And change

    jQuery(this).parent().addClass('ewd-ulb-lightbox');
    

    to

    jQuery(this).parent().removeClass('ewd-ulb-lightbox');
    

    By doing that, you could then actually use “Images with the Following CSS Selectors” option to specify which selectors you want to exclude from using the lightbox, instead of which you want to include.

    Thread Starter Jon

    (@omanhene)

    Thank you, I will give that a try.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Disabling Lightbox for just one gallery’ is closed to new replies.