Add Class To All Gallery Thumbnail Links

In some scenarios you might want to add a specific class to all the anchor tags generated by FooGallery.

A practical example: some themes are hard coded to use certain lightboxes, so you might see 2 lightboxes shown when a gallery thumb is clicked (FooBox aswell as the lightbox packaged into the theme). The only way to turn off or disable the packaged lightbox is to add a class of “no-lightbox” onto the anchor tags.

You can do this by adding this code snippet to your functions.php file:

function foogallery_links_no_lightbox($attr, $args, $foogallery_attachment) {
    if ( ! isset( $attr[ 'class' ] ) ) {
        $attr[ 'class' ] = 'no-lightbox';
    } else {
        $attr[ 'class' ] .= ' no-lightbox';
    }
    return $attr;
}

add_filter( 'foogallery_attachment_html_link_attributes', 'foogallery_links_no_lightbox', 10, 3 );

Please note that this only works with the magnificPopup lightbox

Resources

Find the right next step

Use this grid for documentation indexes, support routes, account links, affiliate resources, and download pages.

Documentation

Search setup guides, product docs, and troubleshooting articles.

Support

Open a ticket with product details so we can help quickly.

Licensing

Review account, renewal, refund, and license information.

Pricing update

Monthly & Lifetime plans are currently not unavailable

We’re not offering these payment options right now. Leave your name and email and we’ll let you know as soon as they return.

NameEmailNotify Me

No spam - Unsubscribe anytime