Complianz Privacy Suite

Using shortcodes in the wizard for global content

Aert Hulsebos

Aert Hulsebos

Categories

Popular articles

Generating an Impressum

From release 4.4 onwards, Complianz Privacy Suite (Premium) offers a new document, the Impressum. The Impressum provides the required information for commercial websites that target

Read More
Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Are you using shortcodes on your website to display global content, for example, telephone numbers, email addresses, names, etcetera?

Here is how you can use them with Complianz. Especially handy for multisite environments where shortcodes can manage global content.

Although shortcodes are interpreted, there are two things we need to take care of in the wizard; validation of email with a shortcode and adding scripts with shortcodes.

We suggest using an MU-plugin to add filters.

Preparing for email validation.

add_filter( ‘cmplz_cookiebanner_settings’, ‘my_shortcode_filter’ );
function my_shortcode_filter($output){
$output = do_shortcode($output);
return $output;
}

add_filter(‘cmplz_fields’, ‘my_cmplz_filter_fields’, 10, 1);
function my_cmplz_filter_fields($fields) {
$fields[’email_company’][‘type’] = ‘text’;
return $fields;
}

Scripts output from shortcode

e.g, when you use [analytics client=”name”] it should be interpreted as UA-123456789-1 instead of [analytics client=”name”]

add_filter( ‘cmplz_script_filter’, ‘my_script_filter’ );
function my_script_filter($script){
$script = do_shortcode($script);
return $script;
}

Related articles

Leave a Reply

Your email address will not be published.

Subscribe