Adding YouTube Support to the WP Featherlight Plugin
I’m a big fan of the WordPress plugin WP Featherlight.
WP Featherlight looks through post content and finds images that link to themselves and turn their links into lightbox-ready images, which helps visitors magnify the image with the click of a button.
Want to see it in action? Here, we have it installed on this site. Click the image below:
We noticed that the Featherlight framework that WP Featherlight Plugin uses has iframe/YouTube support, but we couldn’t figure out how to make the official WP Featherlight plugin tell our images to launch YouTube videos when visitors clicked images.
We ended up forking the original WP Featherlight plugin and we made a few modifications to support this needed case scenario.
Here, try clicking on Cameron Frye at the Museum again below.
Pretty cool right?!
To get this effect all I had to do was tell Gutenberg to link the image to the YouTube video and the modded plugin took care of the rest.
For the modified version, please head to the git repository below:
Experimenting with adding YoutTube support to WP Featherlight
Some future improvements would be to extend support to Vimeo and other popular video players. It might also be well to support HTML-powered content.
There’s a lot of room to explore! And who knows, maybe the original developers will see this post and bake support into the original plugin.
Get help with difficult WordPress projects
Codeable.io provides over 500 senior WordPress Experts that can help you get past dead ends.