Wrapping content in consent shortcodes

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.

We have made numerous integrations with popular services and plugins to control consent automatically and add placeholders when necessary. In some cases, you might want to use shortcodes instead to wrap your content. There are a few things to consider;

  • When used in combination with caching, the ‘cache_redirect=true’ attribute should be added
  • The shortcodes come with a placeholder text. You can use CSS to design the placeholder to your needs. Below you will find examples.
  • You will need to manually add these wrappers in HTML.
  • A page reload or redirect is necessary to trigger the content in your consent area.

If you need an integration with a service or plugin, please log a support ticket. If the plugin is actively supported and has a decent following, we will integrate if needed, or write an article on how to use the script center for this purpose.

The shortcode

Below you will find the shortcode wrapper. The first opening shortcode should be wrapped in brackets [shortcode], the closing shortcode should be wrapped in [/shortcode]. In the examples below I’ll remove the square brackets in the examples below, to prevent WordPress from rendering it as shortcode, which we don’t want here. 

In combination with caching

By default, the page is reloaded on consent, to make sure the PHP is executed. If you use caching, add the cache_redirect attribute, like this cmplz-consent-area cache_redirect=true. When this is enabled, the plugin redirects the pages to a URL with ?cmplz_consent=1 behind. This allows the caching tool to cache the consent page separately.

Specifying categories

You can also select which category should be accepted for the content, by adding the category attribute.

 cmplz-consent-area category=’marketing’ cache_redirect=true

Overriding the text

By using the ‘text’ attribute you can change the text on the blocked content placeholder. A commonly used text is “Accept marketing cookies to view this content”.

An example with styling

Hello! Please revoke your cookie settings to see a placeholder

Used CSS for this placeholder

You can download, and customize the cookie flaticon here.

Recent articles

Integration with Woodmart Google Maps

An integration with the WoodMart theme is available as an MU Plugin on GitHub: https://github.com/Really-Simple-Plugins/complianz-integrations/blob/master/woodmart-custom-google-maps.php

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

Categories

Popular articles

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