The Privacy Suite for WordPress

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.

Recent articles

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

Categories

Popular articles

Subscribe