Last active
January 3, 2023 09:54
-
-
Save AertHulsebos/2d1a96999cb25e41f270dd29eb217832 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Override cookiebanner template html | |
* @param string $html | |
* | |
* @return string | |
*/ | |
function cmplz_custom_banner_file($path, $filename){ | |
if ($filename === 'cookiebanner.php' ) { | |
error_log("change path to ".trailingslashit(WPMU_PLUGIN_DIR).'cookiebanner/cookiebanner.php'); | |
return trailingslashit(WPMU_PLUGIN_DIR).'cookiebanner/cookiebanner.php'; | |
} | |
return $path; | |
} | |
add_filter('cmplz_template_file', 'cmplz_custom_banner_file', 10, 2); | |
/** | |
* Completely override CSS generated by Complianz | |
* @param string $css | |
* | |
* @return string | |
*/ | |
function my_custom_banner_css($css){ | |
ob_start(); | |
//add css below | |
?> | |
.cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-banner-checkbox .cmplz-label { | |
padding-left:0px!important; | |
} | |
.cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-banner-checkbox input.cmplz-consent-checkbox:checked + .cmplz-label::before { | |
display:none!important; | |
} | |
.cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-banner-checkbox .cmplz-label:before { | |
display:none!important; | |
} | |
.cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-banner-checkbox .cmplz-label:after { | |
display:none!important; | |
} | |
.cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-category-header { | |
} | |
.cmplz-always-active { | |
color: #16a085!important; | |
} | |
@charset "UTF-8"; | |
input[type=checkbox] { | |
position: absolute; | |
opacity: 0; | |
z-index: -1; | |
} | |
.cmplz-label { | |
display: flex; | |
align-items: center; | |
width: 2em; | |
height: 1em; | |
background: #690e0e; | |
border-radius: 2.5em; | |
transition: all 0.5s ease; | |
cursor: pointer; | |
} | |
.cmplz-custom-toggle { | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
width: 1em; | |
height: 1em; | |
background: #9d1111; | |
border-radius: 50%; | |
transition: all 0.5s ease; | |
box-shadow: 0 0 8px rgba(0, 0, 0, 0.3); | |
} | |
.cmplz-custom-toggle:before { | |
content: "×"; | |
color: white; | |
font-size: 0.8em; | |
font-weight: bold; | |
} | |
input[type=checkbox]:checked + .cmplz-label { | |
background: #16a085; | |
} | |
input[type=checkbox]:checked + .cmplz-label .cmplz-custom-toggle { | |
margin-left: 50%; | |
background: #1abc9c; | |
} | |
input[type=checkbox]:checked + .cmplz-label .cmplz-custom-toggle:before { | |
content: "✔"; | |
} | |
.cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-description { | |
line-height: 1.5em; | |
} | |
<?php | |
return ob_get_clean(); | |
} | |
add_filter('cmplz_cookiebanner_css', 'my_custom_banner_css'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment