• 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
  • Web Sites
  • Online Marketing
  • WordPress Support
    • Customized WordPress Training
  • 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.

You might also enjoy...

Strong Testimonials PluginStrong Testimonials – Problem with v2.40.2 FooGallery Plugin for WordPress: First Look FooGallery PROHow to Build Stunning WordPress Photo Galleries Quickly and Easily With FooGallery PRO Dynamic Photo Galleries with Responsive Lightbox & Gallery Default ThumbnailDownscaling 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 Add Custom Contextual Help Content To The WordPress Dashboard September 19, 2020
  • WordPress Manual Excerpts: Why, When, & How to Use Them August 12, 2020
  • How to Build Stunning WordPress Photo Galleries Quickly and Easily With FooGallery PRO June 17, 2020
  • How to Hide the Mai Lifestyle Pro Banner Area With Code June 15, 2020
  • Sharing Blog Posts on Social Networks: How and Why June 11, 2020

Filter By Category/Tag

Categories

  • Case Studies (7)
  • General (57)
  • Portfolio (4)
  • Reviews (11)
  • Snippets (13)
  • Techniques (33)

Popular Tags

Advanced Custom Fields Arrays Blogging Child Themes Content Marketing CSS Customer Service Custom Fields Custom Post Types Diagnostics Email Facebook FooGallery Genesis HTML Images iPhone Libra Live Chat Marketing Media MySQL NextGen Gallery PayPal Photo Gallery php Pinterest Plugins Post Formats Pricing Programming Project Management SEO Seth Godin Shortcodes Social Networking Surveys Tables Taxonomies Twitter Web design Web forms WordBooker WordPress YouTube

partners

siteground wp hosting

Web Hosting

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 2021, 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

×