Complianz Privacy Suite

Changing the text in your legal documents

Aert Hulsebos

Aert Hulsebos

Categories

Popular articles

Editing Legal Documents

The legal documents are generated by the Wizard and will show up under ‘Pages’ with a shortcode in the content. This shortcode is used to

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

A quick introduction

Why do we propose changing your texts by way of functions.php, hooks and filters?

The policies are generated by our wizard and placed via shortcode. This has 2 main reasons: updates & translations.

The wizard and policies are drafted by a specialized IT Firm, with upcoming changes in GDPR, ePrivacy and other privacy laws, together with the need of different languages, the best way is to update through shortcode. Hassle free for our users.

When changing the text directly, above updates are no longer possible and will undermine the functionality of the plugin. To resolve this, most changes can be made with a code snippet in your theme’s functions.php. This will minimize the problem of updating legal texts and translations.

Making your own code snippet (or filter).

Below is the code needed to change your text, adding this to your theme’s functions.php will do the trick.

NB.

  • The filter (and you) needs to know which string to change or replace. This means there should be an identifier in both your old and new string to signify it should be replaced.
    • For example: If you want to change: “Red apples are sold out” to “Red apples are on sale”. You will need to start the new string with “Red apples are” to show which string it should replace. For complicated changes you can ask support!
    • The more unique the string, by wording or characters, the better.
  • Please rename or copy your current functions.php as a back-up
  • If you have a child theme, please use the functions.php of your child theme. Or even better, place the code in a must use plugin.

The Code

function cmplz_edit_document_html($html, $type, $post_id){

$old_string = "This is the old text you want to change";
$new_string = "This is the new text you want to add.";
$html = str_replace($old_string, $new_string, $html);
return $html;

}

add_filter('cmplz_document_html', 'cmplz_edit_document_html', 10, 3);

Related articles

3 Responses

Leave a Reply

Your email address will not be published.

Subscribe

We have released 4.0 for Premium. For more information about Cookiedatabase.org and New Features...