• Resolved alecar

    (@alecar)


    Hello,

    I have been using complianz for a long time and I really like the plugin.

    The issue I am having right now is that if I insert an embed post of my own wbesite inside a post, the cookie banner loads poorly inside it and a giant X appears right after the embed post.

    From what I understand, is the way embed post work on wordpress it loads an iframe of the post, and in this case that it is refering to my own website, it loads “twice”.

    Is there a way to solve this?

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Aert Hulsebos

    (@aahulsebos)

    Hi @alecar,

    You can disable Complianz on that specific post you’re embedding if possible, under post edit, right-hand sidebar.

    This will disable Complianz on that post, a hybrid version where you need to remove it in the iFrame itself is only possible with some custom javascript.

    regards Aert

    Plugin Contributor Aert Hulsebos

    (@aahulsebos)

    Or try:

    // Check if the current window has a parent window
    if (window.parent !== window) {
        // If the current window has a parent window, hide the cookie banner
        var cookieBanner = document.querySelector('.cmplz-cookiebanner');
        if (cookieBanner) {
            cookieBanner.style.display = 'none';
        }
    }
    Thread Starter alecar

    (@alecar)

    Hello Aert,

    For some reason when the embed post loads, it does not load my theme’s custom css and js, so the solution I found was inserting a style tag inside of embed-content.php wordpress core file with this code on my functions.php:

    function custom_embed_styles() {
        // Your custom styles here
        $custom_styles = "
            .post-template-default div#cmplz-cookiebanner-container,
        .post-template-default #cmplz-manage-consent {
            display: none;
        }
    
        .post-template-default.tdb-template #cmplz-manage-consent,
        .post-template-default.tdb-template #cmplz-cookiebanner-container {
            display: block !important;
        }
    	.td-wp-booster-error {
        display: none !important;
    }
        ";
    
        echo '<style type="text/css">' . $custom_styles . '</style>';
    }
    add_action('embed_head', 'custom_embed_styles');

    I do not know if the best way, but it worked for me.

    Thank you for your quick reply!

    Kind regards.

    • This reply was modified 1 year, 2 months ago by alecar.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cookie banner appearing inside wordpress embed post’ is closed to new replies.