LowEndBox - Cheap VPS, Hosting and Dedicated Server Deals

@Ympker's Cool WordPress Plugin to Ease GDPR Compliance!

Wordpress Logo

As reported here on Low End Box a few days ago, a German court found that the European Union’s General Data Protection Regulation (GDPR) required website hosts to avoid sharing readers’ IP addresses with Google Fonts.

Just a weekend after the court’s ruling, my good friend @Ympker wrote a WordPress plugin to facilitate GDPR compliance by hosting and serving fonts locally.

@Ympker’s cool plugin is only a few lines of code! Thus, in addition to solving a currently significant legal problem, @Ympker’s plugin also offers us a quick peek at what a WordPress plugin looks like on the inside!

I asked @Ympker some questions. He wrote and then added to this article. Then I asked more questions, and then I made some edits. So, if there’s a goof somewhere, please blame me, not @Ympker!

Screenshot of @Ympker plugin at Github

Hello everyone,

I was invited by @Not_Oles to talk a bit about the plugin for WordPress I recently published on GitHub which is something I am more than happy to do.

For those of you that are wondering what a WordPress plugin is: It is essentially an “add-on” that extends the default features shipped with WordPress.

About the GDPR plugin:

I created this mini-plugin because I needed a quick solution to self-host the free Fontawesome icons on my clients’ websites after a German court had ruled that embedding Google Fonts that are retrieved from Google Servers to be violating GDPR.

Since it can be assumed that the court ruling would be applied to similar scenarios in which fonts or other resources are retrieved from remote servers, over a weekend, this plugin came to be.

The plugin currently is based on the Fontawesome free fonts v 6.0.0, which appears to be supporting backwards compatibility for sites still using v5 fonts/syntax.

Moving forward, I will likely add a new plugin/folder in the Github repo when a new (major) version is released.

The plugin has been tested with WordPress 5.9 and has been implemented on a couple of client sites of mine. It seems to be working without any issues, but USE AT YOUR OWN RISK! In the Github repository, you will find a README on how to use the plugin.

Although the code is relatively short, it took me some googling and viewing code examples before I could write this plugin, since I didn’t have much experience writing WordPress plugins before.

A short summary of the code:

When looking at the code of the plugin, it introduces a function named “add_fonts” which registers the style (in this case the fontawesome fonts CSS stylesheet) and then enqueues it.

You could tweak these lines to embed any stylesheet or script you want, really. On Github, I have also added some comments to the code which include useful references if you want to try and DYO ;)

The code:

function add_fonts() {
wp_register_style('all', plugin_dir_url( __FILE__ ) . 'css/all.css');
wp_enqueue_style('all');

}
add_action(‘wp_enqueue_scripts’, ‘add_fonts’,1);

Download:

The latest compressed version of the plugin, just like any other plugins I will publish, is available in this Shared Folder. Of course, you can also clone it from GitHub and zip it yourself following the instructions in the README, or download it from the link that is provided there.

If there are any issues with the plugin, feel free to open a GitHub issue and I will try my best to help you. :)

[WIP] A page dedicated to all my plugins:

I will soon add a sub-page on my website which will be dedicated to all my current and future plugins. Stay tuned!

Future outlook:

In the future, I am looking forward to diving more into the world of plugin development, as it is a very interesting topic and it allows me to cater to the special needs of my clients without relying on third-party plugins that may not receive any updates at some point.

I also plan to create plugins to embed Bootstrap and TailwindCSS based on the code above very soon. Stay tuned and feel free to follow my WordPress Plugins repository where I will publish any future plugins.

I could also imagine that I will try to add the Plugin to the official WordPress repository so that more people learn about it and can use it on their websites. The feedback I have received from the communities I shared it with so far has been very positive and welcoming. This is a good motivation to keep me going ;)

Thank you @Not_Oles for giving me the opportunity to present my plugin via this platform!

Not_Oles

2 Comments

  1. Susan:

    Nice share, thank you!

    February 26, 2022 @ 4:26 pm | Reply
    • Not_Oles:

      Hi Susan! Glad you enjoyed it! :)

      February 26, 2022 @ 5:09 pm | Reply

Leave a Reply

Some notes on commenting on LowEndBox:

  • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
  • Akismet is used for spam detection. Some comments may be held temporarily for manual approval.
  • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

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