Skip to content

Instantly share code, notes, and snippets.

View AertHulsebos's full-sized avatar

Aert Hulsebos AertHulsebos

View GitHub Profile
/**
* Add custom css to banner css file
* @return void
*/
function add_my_custom_banner_css() {
?>
.cmplz-cookiebanner {
}
/*
To ensure this file is minified, comment the import in document.less, then save this file.
*/
#cmplz-manage-consent-container {
display: none;
}
#cmplz-manage-consent-container.cmplz-manage-consent-container .cmplz-categories summary {
display: block;
cursor: pointer;
}
(function(w, d, t) {
for (i of w[d])
t += JSON.stringify(i).replaceAll(/\"\d{1,}\":/g, "") + "\n";
console.log(t);
})(window, "dataLayer", "")
(() => {
l = s => s == undefined ? "" : s ? "granted" : "denied";
c = s => s == "granted" ? "color: #29b6f6": "color: #C00";
if (!"google_tag_data" in window) {
console.log("No Consent Mode data found, please check your Complianz settings.");
return;
}
var g = google_tag_data.ics.entries, i = "", t = "", u = "";
define(‘WP_DEBUG’, false);
*/ Should be changed to below /*
define(“WP_DEBUG”, true);
define(“WP_DEBUG_DISPLAY”, false); //prevents errors from showing on the front-end
define(“WP_DEBUG_LOG”, true);
<?php
add_filter( 'cmplz_script_filter', 'my_script_filter' );
function my_script_filter($script){
$script = do_shortcode($script);
return $script;
}
<?php
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) {
.cmplz-consent-checkbox {
position: relative;
z-index: 1;
stroke: black;
fill: none;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 3.5;
transition: all .2s ease;
}
<div class="cmplz-blocked-content-notice cmplz-accept-cookies" style="text-align: right; cursor: pointer;">
Click here to accept reCaptcha cookies before sending the form.</div>