|
/* |
|
* Add a new plugin called Code Snippets, put snippet |
|
* or use theme functions.php bottom line |
|
*/ |
|
add_action( 'wp_footer', 'gdpr_consent_gforum' ); |
|
function gdpr_consent_gforum() { |
|
echo ' |
|
<p class="cookies-warning" style="display:none;"> |
|
GulshanForum uses cookies to make its website easier to use. <a href="https://help.gulshankumar.net/t/privacy-policy/6">Learn more about cookies.</a> |
|
<a href="#close" class="close">X</a> |
|
</p> |
|
<style type=\'text/css\'> |
|
.cookies-warning { |
|
position: fixed; |
|
bottom: 10px; |
|
left: 50%; |
|
-webkit-transform: translateX(-50%); |
|
transform: translateX(-50%); |
|
z-index: 1000; |
|
background: rgba(46,50,52,0.75); |
|
box-shadow: 0 3px 4px 0 rgba(46,50,52,0.1); |
|
border-radius: 5px; |
|
text-align: center; |
|
color: #fff; |
|
font-size: 12px; |
|
padding: 10px 13px 10px 20px; |
|
display: inline-block; |
|
width: 100%; |
|
max-width: 560px; |
|
} |
|
.cookies-warning .close { |
|
color: #CCCCCC; |
|
display: inline-block; |
|
padding: 5px; |
|
font-size: 1.2em; |
|
font-weight: 600; |
|
position: relative; |
|
top: 2px; |
|
transition: 0.18s cubic-bezier(0.55, 0, 0.1, 1); |
|
text-decoration: none; |
|
text-shadow: none; |
|
opacity: 1; |
|
} |
|
.cookies-warning a { |
|
color: #fff; |
|
opacity: 0.7; |
|
text-decoration: none; |
|
display: inline-block; |
|
} |
|
</style> |
|
<script type=\'text/javascript\'> |
|
jQuery(function() { |
|
var text = jQuery(\'.cookies-warning\'); |
|
var sign = text.find(\'.close\'); |
|
cookieTxt = "cookiesWarningSeen=1"; |
|
if (document.cookie.indexOf(cookieTxt) !== -1) { |
|
return; |
|
} |
|
text.show(); |
|
sign.click(function() { |
|
window.cookieToggle = function() {}; |
|
text.hide(); |
|
document.cookie = cookieTxt; |
|
}); |
|
window.cookieToggle = function() { |
|
text.toggle(); |
|
}; |
|
}); |
|
</script> |
|
'; |
|
} |
|
// Credit: https://help.gulshankumar.net/t/simple-cookie-warning-notification/1747/20 |