Add a link to show the Cookie Banner

Get compliant today in the European Union, United States, Canada, United Kingdom, Australia, Brazil & South Africa with the only Privacy Suite for WordPress that offers a fully-featured plugin for Worldwide Compliance.

You may want to insert a link or button that opens the Cookie banner to allow your visitor to change their preferences. The available Complianz shortcodes have been listed in an earlier article, Used shortcodes by Complianz, but you might have noticed that there is no shortcode that shows the Cookie banner without revoking consent.

Luckily, this can easily be fixed with some customization.

Adding javascript to trigger the Cookie banner

By adding the filter below, the banner can be triggered with a single click and without altering your users’ consent choices.

This script can either be added as a recommended MU Plugin or to functions.php, most preferably in your child’s theme. This will also work in a plugin like Header Footer Code Manager, but in this case you can only use the code between the script tags. Don’t forget the script tags as well.

Creating a link that opens the Cookie banner

Adding a custom CSS class to your link will trigger the filter that you added in the previous step. An example is shown below:

You can also add the class to a button if so preferred. This is how you can style your new link:

Here’s an example!

Manage your cookie preferences by clicking here.

Recent articles

The Privacy Suite for WordPress
Get compliant today with the only Privacy Suite made for WordPress


Popular articles

Join our mailing list - 8 Tips & Tricks in your inbox over the next 8 weeks!