Today we’re creating an almost full screen replica of a banner requested by @kwent on WordPress.org. It’s a – not so subtle – consent banner presented in full width with clear typography. The banner HTML is edited slightly, but most configuration can still be done under Cookie Banner settings in the plugin. There’s also a component of changed CSS, which can be altered to your wished.
If you know your way around MU plugins, please find the MU plugin with CSS and HTML here. Please note that in the banner.php the function “function regenerate_banner()” should be removed after publishing.
How to add this banner to your website!
You will need to create a MU plugin for best results. We will explain shortly below how, for a longer explanation, please read this article.
The first thing is to override the cookie banner template with your own HTML, or in this case the HTML from this banner request:
- Create a folder called ‘cookiebanner’
- Create a file called ‘cookiebanner.php’ and put in the folder ‘cookiebanner’
- Add the code below to cookiebanner.php and save the file.
Next, make sure this file is used as your cookie banner template. We can do this to create a banner.php file that tells Complianz to switch to this template. This file also includes CSS that is used to create some of the styling.
Create a file called banner.php, and save the code below to create the override.
Add it to the MU Plugins folder
When the files are ready follow these simple steps:
- Go to your WordPress installation with FTP or File Manager
- Look for wp-content/mu-plugins/
- If it’s not there you can create the folder yourself.
- Add your created files to the /mu-plugins/ folder, it should look like this: