[Resolved] Have any code or way to loading generateblocks with condition?

Home Forums Support [Resolved] Have any code or way to loading generateblocks with condition?

Home Forums Support Have any code or way to loading generateblocks with condition?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1609873
    Mr Calvert

    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' );
                    }
    	}
    }
    #1610174
    David
    Staff
    Customer Support

    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 ?

    #1610805
    Mr Calvert

    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!!!

    #1611109
    David
    Staff
    Customer Support

    Glad to hear you found the issue!

    #1611119
    Mr Calvert

    Yes thanks you so much!!!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.