Site logo

Archived topic

Have any code or way to loading generateblocks with condition?

4 replies · Started by Mr Calvert on January 7, 2021

Viewing posts 1–5 of 5

Hello! When I check with Ctrl + U I see the post of used this code:
<style id="generateblocks-css">.gb-container .wp-block-image img{vertical-align:middle;}.gb-container .gb-shape{position:absolute;overflow:hidden;pointer-events:none;line-height:0;}.gb-container .gb-shape svg{fill:currentColor;}.gb-container.gb-container-845f5aca > .gb-inside-container{padding:30px 0;max-width:1200px;margin-left:auto;margin-right:auto;}.gb-container.gb-container-1865c68e > .gb-inside-container{padding:40px 0;max-width:1200px;margin-left:auto;margin-right:auto;}.gb-icon{display:inline-flex;line-height:0;}.gb-icon svg{height:1em;width:1em;fill:currentColor;}.gb-highlight{background:none;color:unset;}@media (max-width: 767px) {.gb-grid-wrapper > .gb-grid-column{width: 100%;}}</style>
But I think this code not necessary because this is post, not custom page and I not use and block of plugin Generate Block.
So have any code or way to loading generateblocks with condition? I don't want CSS of Generate Block load in post!
I was add code like this but it not useful:

add_action('wp_enqueue_scripts', 'remove_css_generateblocks_post', 99);
function remove_css_generateblocks_post() {
	if(function_exists('is_generateblock')) {
                if(is_single()){
                wp_dequeue_style( 'generateblocks' );
                }
	}
}

Hi there,

GB does loads it CSS conditionally based upon the blocks present on the page. So something else must be going on here
Can you share a link to the page where this is happening ?

I was know why! Thanks you so much because post demo have use image block of generateblocks.

<div class="gb-container gb-container-1865c68e"><div class="gb-inside-container">
<div class="wp-block-image rounded-corners">

Thanks you!!!

Glad to hear you found the issue!

Yes thanks you so much!!!

This archived topic is closed to new replies.