• Resolved tulip11

    (@tulip11)


    Hi,
    I have multiple sites which are using the Complianz plugin and also MetaSlider. When you go into the Gutenberg editor, add a MetaSlider block and select a slider, it displays the content of the cookie bar underneath the slider and a huge closing image X. This only appears in the editor, not in either Preview mode or the published page. Probably this is because Metaslider uses iframe to show the preview of the slider and Complianz acts on the iframe.

    Is there any way to hide the cookie bar on the MetaSlider preview or something else to prevent this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor jarnovos

    (@jarnovos)

    Hello @tulip11,

    MetaSlider seems to load the website in an iFrame, and as the banner HTML is a part of that, it’s also displayed.

    I installed the MetaSlider plugin myself, placed it on a page in the Gutenberg editor and found that it also includes elements such as the WPML Language Switcher. Perhaps MetaSlider knows of a method you can use to avoid this from happening in their Gutenberg preview?

    Kind regards,
    Jarno

    Thread Starter tulip11

    (@tulip11)

    I can try to ask them but I found a support ticket where their solution was:

    MetaSlider is using an iframe to create a preview. I’m guessing the cookie consent gets embedded right through the body tag, that’s why it’s also showing in the MetaSlider preview. This could be avoided by maybe making sure that the cookie consent doesn’t get displayed in the admin dashboard.

    So is there any way to prevent the cookie consent to show in admin dashboard?

    Plugin Contributor jarnovos

    (@jarnovos)

    Hello @tulip11,

    You can use the below filter to ensure that the Cookie Banner isn’t loaded in the MetaSlider preview. You can apply this as an MU Plugin: copy the code to a new .PHP file and place it in the folder /wp-content/mu-plugins/ for it to take effect.

    <?php
    defined( 'ABSPATH' ) or die( "you do not have acces to this page!" );
    
    function cmplz_my_filter_site_needs_cookiewarning( $cookiewarning_required) {
    	$url = is_ssl() ? "https" : "http";
    	$url .= "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
    
    	if( !empty($_GET['action']) && $_GET['action'] == 'ms_get_preview' ) {
    		$cookiewarning_required = false; 
    	}
    	return $cookiewarning_required;
    }
    
    add_filter( 'cmplz_site_needs_cookiewarning', 'cmplz_my_filter_site_needs_cookiewarning' );

    Kind regards,
    Jarno

    Thread Starter tulip11

    (@tulip11)

    Oh, thank you, it works great!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Metaslider and Gutenberg editor’ is closed to new replies.