Search
Close this search box.

Documentation

In this article

Categories

Recent articles

Add a link to show the Cookie Banner

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.

Join 700.000 users and install The Privacy Suite for WordPress locally, automated or fully customized, and access our awesome support if you need any help!

Complianz has received its Google CMP Certification to conform to requirements for publishers using Google advertising products.