• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

nSiteful Web Builders

Building a Better Web - One Site at a Time.

  • Home
  • About
    • Testimonials
    • Resources
  • Web Sites
  • Online Marketing
  • WordPress Support
    • Customized WordPress Training
    • 60-for-60 Sessions
  • Web Applications
  • Blog
    • Archive Listing Minimalistic
    • Blog Articles Grouped by Category
    • Case Studies
    • General
    • Portfolio
    • Reviews
    • Snippets
    • Techniques
  • Contact Jeff
    • Purchase Retainer Consulting Hours
    • About Retainer Consulting Hours
Make Responsive Lightbox by dFactory Work with FooGallery

By Jeff Cohan, July 23, 2016

Make Responsive Lightbox by dFactory Work with FooGallery

Last updated May 10th, 2019 at 11:08 am

This is a repurposing of an earlier blog article, First Look at Foo Gallery. I wanted to make it easy for people to find this solution for making FooGallery and Responsive Lightbox by dFactory work together.

Out of the box, the only lightbox plugin These are what make thumbnails enlarge in modal windows FooGallery supports is its own, FooBox. But I’ve become a big fan of Responsive Lightbox by dFactory (RLBD), whose free version offers many useful features (including video support) that you can’t get with the free version of FooBox.

Typically, and by default, Responsive Lightbox by dFactory jumps into action whenever the browser loads an image that contains a data-rel attribute with a value of lightbox. Also, one of the configuration options for RLBD is to automatically insert that attribute-value pair inside img tags. However, FooGallery defeats that process. So we need a workaround.

The Snippet to make Responsive Lightbox by dFactory work with FooGallery

(Hat-tip to one of the FooGallery plugin authors who offered this solution in the plugin’s support forum.)

To make Responsive Lightbox by dFactory work with FooGallery, use the following code to hook into one of FooGallery’s filters. Add the code to a file in your site’s mu-plugins folder.

function add_foogallery_link_rel($attr, $args, $attachment) {
	$attr['data-rel'] = 'lightbox';
	return $attr;
}
add_filter('foogallery_attachment_html_link_attributes', 'add_foogallery_link_rel', 10, 3);

PS: If you’re wondering why I didn’t tell you to put the code in your theme’s functions.php file — or if you’re not familiar with the mu-plugins folder, feel free to comment below.

Related Posts

  1. Strong Testimonials – Problem with v2.40.2
  2. FooGallery Plugin for WordPress: First Look
  3. How to Build Stunning WordPress Photo Galleries Quickly and Easily With FooGallery PRO
  4. Dynamic Photo Galleries with Responsive Lightbox & Gallery
  5. Downscaling Images On Upload in WordPress
  • Choose the best match.

Written by Jeff Cohan · Categorized: Snippets · Tagged: FooGallery, Media, Plugins, WordPress

  • Choose the best match.

Reader Interactions

Comments

  1. Rikke Joergensen says

    September 13, 2016 at 5:51 am

    Hi Jeff

    Thanks for the code snippet! I really wanna use FooGallery and Responsive Lightbox as well – it seems to be the best of both worlds 😉 I’m kind of new to this, so I am not familiar with the mu-plugins folder, so if you could elaborate on how to use that it would be great!

    Reply
    • Jeff Cohan says

      September 13, 2016 at 10:31 am

      Thanks for your comment, Rikki.

      The “mu-plugins” folder is a special, optional folder in WordPress whose primary purpose (nowadays) is to house plugins (i.e., script files) that must always be enabled, regardless of which theme is activated. Every file in this folder is considered a plugin, and plugins in this folder do not appear on the default Plugins dashboard page and thus cannot be deactivated by users.

      The folder must be manually created, as it does not exist by default.

      For the use case I described in this post, I want Responsive Lightbox by dFactory to always work with Foo Gallery, regardless of which theme is active. That’s why I didn’t add the code to the theme’s functions.php file.

      For more info, check out this codex article.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

mailchimp signup

Subscribe to get notified when new articles are published. Unsubscribe any time. No spam. I promise. Check out my newsletter archives.

social

Twitter Facebook LinkedIn

Recent Articles

  • Use Case for Custom Post Type: “In The News” March 10, 2023
  • Create a Custom Shortcode to Display a MemberPress Membership Price ANYWHERE on Your Website February 5, 2023
  • Avoid Direct Styling; Use CSS Instead September 21, 2022
  • Blog Tags: What They Are (and What They’re Not) August 5, 2022
  • How to Create a Simple Custom Events Plugin May 24, 2022

Filter By Category/Tag

Categories

  • Case Studies (7)
  • General (61)
  • Portfolio (5)
  • Reviews (12)
  • Snippets (16)
  • Techniques (38)

Popular Tags

Advanced Custom Fields Blogging Child Themes Content Marketing CSS CSS Grid Customer Service Custom Fields Custom Post Types Diagnostics Facebook FooGallery Genesis Gutenberg HTML Images iPhone Libra Live Chat Marketing Media MemberPress MemberPress Courses mu-plugins MySQL Photo Gallery php Pinterest Plugins Post Formats Pricing Project Management Security SEO Seth Godin Shortcodes Social Networking Surveys Taxonomies Trello Twitter Video Web design Web forms WordPress

siteground wp hosting

Web Hosting

wp101

EasyWordPresstutorialvideosforbeginners.
MemberPress CTA

Footer

Background

Web Sites | WordPress Support | Web Applications.

Formally trained in liberal arts and education (I have a B.A. in Government from Harvard and studied Secondary Education at Rutgers Graduate School), I have honed my skills in the communication arts and sciences as a teacher, trainer, instructional designer, writer, photographer, calligrapher, helpdesk manager, database programmer, and multimedia developer.

(I've also been a group counselor, waiter, bartender, bicycle messenger boy, computer salesman, carpenter's helper, financial analyst, and school board president.)

Tech

Systems since 1983.
Web sites since 1994.
PHP since 2001.
WordPress since 2007.

Contact

770-772-5134
Email Jeff
Send Money
All Ways

Copyright 2023, nSiteful Web Builders, Inc.

 

Subscribe

Pardon the interruption. I know popups can be annoying. But I’d love to have you as a subscriber.

Sign up to be notified when new articles are published. Unsubscribe any time.

* indicates required

Powered by MailChimp

×