Support Forum Support Forum GDPR Cookie Compliance iframe support when created by shortcode or javascript

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • September 09, 2021 @ 7:06 pm

    We have some PHP code and html in a template that creates iframes for youtube and twitter. How do we convert these as they are not in the WP editor? The code snippets are:

    <?php echo do_shortcode(“[embedyt] https://www.youtube.com/embed?listType=playlist&list=xxxxxxxxxxxxxx&layout=gallery%5B/embedyt%5D&#8221;); ?>

    and

    Tweets by xxxxxxx <script async src=”https://platform.twitter.com/widgets.js&#8221; charset=”utf-8″></script>

    Both create iframes that we want to have disabled via GDPR Cookie plugin when the website is first loaded

    Moove Agency
    September 10, 2021 @ 5:52 am

    Hi Mike,

    Thanks for using our plugins.

    You try one of the following methods:

    1. You can use a shortcode Put youtube iframe or URL here if the Custom Field you are using supports shortcodes.

    2. In your code where you display the custom field value, you can use the following action: $content = apply_filters( ‘gdpr_iframe_blocker_filter’, $content ); where $content is your custom field value.

    3. If the above doesn’t work, you can try to add the following code snippet to your theme’s functions.php file:
    add_filter( 'the_content', array( 'Moove_GDPR_Addon_Actions', 'gdpr_block_content_iframes' ), 100, 1 );

    Hope this helps.
    Thanks

    Premium
    September 10, 2021 @ 7:56 am

    Hi,

    Thanks for reply I have just noticed that the forum editor has mashed up my original post a bit.

    The first iframe I have is already in a do_shortcode i.e. echo do_shortcode(“[embedyt]…… How can I wrap the existing do_shortcode with your [gdpr_iframe_blocker] shortcode?

    The second iframe content is hard coded HTML in a php file so I tried option 2 and put the text into a variable then try to apply the filter. That did not work. The HTML is Tweets by xxxx <script async src=”https://platform.twitter.com/widgets.js&#8221; charset=”utf-8″></script>

    Premium
    September 10, 2021 @ 8:00 am

    Sorry the editor is wiping out my HTML it is actually an “a” tag with the twitter link in the href and a script file invoking a twitter js file. I have put the whole of that into a PHP variable and applied the filter. The twitter cookie has still been laid down.

    Moove Agency
    September 13, 2021 @ 6:52 am

    Hi Mike,

    More info about Twitter iframe is here:

    Hope this helps.

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘iframe support when created by shortcode or javascript’ is closed to new replies.

MooveAgency - Support Forum
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.