How to Add a Cookie Consent Bar to WordPress
OK, now let’s mention what I will do. I will install 2 plugins for this: one will take care of displaying the cookie consent bar, and the other one will take care of that the cookie notice bar will show to European visitors only. It is required for the EU only, so why bother your US or Asian visitors with this, too.
Also, I’d like to emphasize that this works with any WordPress theme, not just Divi, as these 2 plugins work independently of Divi. And both of these plugins are free.
So the first thing that you need to do is to install the Cookie Consent plugin. Of course there are more cookie consent plugins, but I use particularly this one, because I like its design and I like the feature that it can be set to display for European visitors only (in combination with the second plugin that we will install next).
Now we will install the GeoIP Detection plugin. Then in the settings of this plugin choose the data source “Automatic download & update of Maxmind GeoIP Lite City”. And in the general options at the bottom don’t forget to tick the option “Add a country-specific CSS class to the <body>-Tag.”. This is important, because without this setting it didn’t work for me. So don’t forget to set this up.
The last thing that we need to do is to setup the Cookie Consent plugin. Go to Settings > Cookie Consent in your WP admin panel and you will be able to setup all the options for this plugin. In its general settings I choose all countries except Europe, in the “Exclude Zones” option. This shall make sure that the consent bar will show for European visitors only. Please note that you will need to have the GeoIP Detection plugin installed as well in order to be able to take the advantage of this feature.
And finally, in the Styles tab, you can customize the design of your cookie consent bar. You can choose the colors here and choose between top bar, bottom bar, top left block, top right block, bottom left block or bottom right block. This is up to you. As for me, I prefer just a typical bottom bar and I use the shades of gray as my colors.
So that’s it. I hope I have helped you with this article to make your website compliant with this EU law. And if you are looking for tips on how to add GDPR consent checkboxes to Divi theme or Bloom optins, check out my previous article on this blog.