September 30, 2024
YouTube Facade: a WordPress Plugin
YouTube Facade is the name of this plugin I’m sharing with you, but it started – like most things I make – as something entirely for my own use, on Home for Fiction. A facade is an interface that “masks” another kind of content — in this case, an embedded YouTube video.
Why, you might ask.
Facades serve a dual role:
- They help with privacy requirements. Because the third party (in our case, YouTube) doesn’t load automatically on page load, Google/YouTube can’t place cookies unless the user explicitly allows it.
- They help with site speed, as the page only needs to load a small image, rather than an embedded video.
If you’d like to see how it works, check it out e.g. on this page. Everywhere on the blog (and the main Home for Fiction site) there’s a YouTube video, facades are displayed.
YouTube Facade: The (Basic) Basics
The code is ridiculously simple. Feel free to examine it on its GitHub page, but basically it simply fetches the YouTube thumbnail, it replaces the WordPress embed code with a facade – a custom group of elements (the image, the text, the “play” button representation) – and assigns a click event so that, when the YouTube facade is clicked, the original YouTube embedded video appears.
As I said in the introduction, this protects users’ privacy and significantly speeds up page load.
Download and Use for Free
Simply download the .zip file and extract it into the appropriate location inside your WordPress site. That should be: [yoursite.com]/wp-content/plugins
. Then, from your WordPress dashboard, activate it and you’re ready to go. No further adjustment is needed.
YouTube Facade: Premium Version
If you found this useful and would like to support it, there’s also a premium version on my Patreon shop, which also allows you to set custom colors. You can either get it for the price of a coffee, or you can become a patron and also get access to tons of other stuff.
(Yes, Mr Walrus is helping me again 😀 )