• Resolved slazt

    (@slazt)


    Hello,

    I would like to have the consent button always visible only within my footer.
    I tried : https://complianz.io/add-a-link-to-show-the-cookie-banner/
    but adding the lines in function.php of my theme child makes fatal error :

    function cmplz_show_banner_on_click() {
    	jQuery(document).ready(function ($) {
    		$(document).on('click', '.cmplz-show-banner', function(){
    			$('.cc-revoke').click();
    			$('.cc-revoke').fadeOut();
    		});
    	});
    }
    add_action( 'wp_footer', 'cmplz_show_banner_on_click' );

    Have I missed something ? Thanks

    Regards,
    Stéphane

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Aert Hulsebos

    (@aahulsebos)

    Hi @slazt,

    I would suggest adding the entire code as shown on the URL as you mentioned as an MU plugin.

    Or make sure you handle the script tags correctly (only remove <?php;

    function cmplz_show_banner_on_click() {
    	?>
    	<script>
            jQuery(document).ready(function ($) {
                $(document).on('click', '.cmplz-show-banner', function(){
                    $('.cc-revoke').click();
                    $('.cc-revoke').fadeOut();
                });
            });
    	</script>
    	<?php
    }
    add_action( 'wp_footer', 'cmplz_show_banner_on_click' );

    regards Aert

    • This reply was modified 3 years, 5 months ago by Aert Hulsebos.
    Thread Starter slazt

    (@slazt)

    Hi @aahulsebos,

    Works perfectly, thank you very much!

    Regards,
    Stephane

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to have a fixed button in the footer instead’ is closed to new replies.