• 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

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

  • How to Create a Simple Custom Events Plugin May 24, 2022
  • Make your Web Site the Heart & Hub of your Online Marketing Strategy March 24, 2022
  • Why SiteGround Hosting? March 11, 2022
  • Tent Birth and Breastfeeding Services January 31, 2022
  • Trello Board Tour: Jeff’s Blogging Board January 30, 2022

Filter By Category/Tag

Categories

  • Case Studies (7)
  • General (61)
  • Portfolio (5)
  • Reviews (12)
  • Snippets (15)
  • Techniques (35)

Popular Tags

Advanced Custom Fields Blogging BlueHost Child Themes Content Marketing CSS Customer Service Custom Fields Custom Post Types Diagnostics Facebook FooGallery Genesis HTML Images iPhone Libra Live Chat Marketing Media MemberPress mu-plugins MySQL online strategy Photo Gallery php Pinterest Plugins Post Formats Pricing Project Management SEO Seth Godin Shortcodes Social Networking Surveys Taxonomies Trello Twitter Video Web applications Web design Web forms WooThemes 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 2022, 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

×