Hi @mcivita,
Adding a Manage Consent link as a Menu item is possible by following the steps below:
– Copy the attached code below to a PHP file and place it in the folder /wp-content/mu-plugins/. Detailed instructions for installing MU Plugins can be found here: https://complianz.io/adding-filters-with-mu-plugins-quick-easy/
<?php
/**
* Show the banner when clicking an element with class 'cmplz-show-banner'
*/
function cmplz_show_banner_on_click() {
?>
<script>
function addEvent(event, selector, callback, context) {
document.addEventListener(event, e => {
if ( e.target.closest(selector) ) {
callback(e);
}
});
}
addEvent('click', '.cmplz-show-banner', function(){
document.querySelectorAll('.cmplz-manage-consent').forEach(obj => {
obj.click();
});
});
</script>
<?php
}
add_action( 'wp_footer', 'cmplz_show_banner_on_click' );
– Add #
as the URL of your Menu Item
– Add the below HTML as the Navigation Label of your Menu Item.
<a class="cmplz-show-banner">Manage Consent</a>
The result will be a clickable link that re-opens the Cookie Banner.
Just let me know if that works for you!
Kind regards,
Jarno
-
This reply was modified 2 years, 9 months ago by jarnovos.