• Hi there,

    Everything’s explained in the video. It seems if I copy a “classic” Gutenberg code with a shortcode (in text or code mode of course), it doesn’t display what’s expected. Some blocks such as Vimeo video don’t work within the shortcode.

    Thanks for your help!

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author vaakash

    (@vaakash)

    Hi @brunoairam,

    I understand the issue. Blocks need to be “executed”. Though they are regular HTML, WordPress needs to know that the HTML is for blocks.

    Right now it is not expected for Shortcoder to contain block HTML.

    I’ll check and get back to you with code to execute the blocks.

    Thanks,

    Aakash

    Thread Starter brunoairam

    (@brunoairam)

    Thanks a lot, waiting for your feedback.

    Plugin Author vaakash

    (@vaakash)

    Hi @brunoairam,

    Can you please paste below code in your theme’s function.php file or via site specific plugin?

    https://www.aakashweb.com/articles/create-site-specific-wordpress-plugin-custom-code/

    function sc_execute_blocks( $shortcode ){
    
        if( !is_array( $shortcode ) ){
            return $shortcode;
        }
    
        $shortcode[ 'content' ] = do_blocks($shortcode[ 'content' ]);
    
        return $shortcode;
    
    }
    
    add_filter( 'sc_mod_shortcode', 'sc_execute_blocks', 10, 1 );

    This should execute the blocks in shortcode.

    I’ll see if this option can be added to the plugin in the future version of the plugin.

    Thanks,

    Aakash

    justineairammontessori

    (@justineairammontessori)

    Hello Aakash,
    I am Justine, working with Bruno.
    We did paste the code in theme’s function.php file.
    The PDF embedder block is working now. But the Vimeo block still doesn’t show : https://drive.google.com/file/d/1Rg0jy6oVZWqGxH8UFTQB0jWhijs_Poko/view?usp=sharing

    Thanks for your help!

    Plugin Author vaakash

    (@vaakash)

    Hi Justine,

    I tried the vimeo “embed block” and it is working on my end.

    Please use the “vimeo embed” block and not just a plain vimeo link. The block code looks like below.

    <!-- wp:embed {"url":"https://vimeo.com/channels/bestofstaffpicks/652309700","type":"video","providerNameSlug":"vimeo","responsive":true,"className":"wp-embed-aspect-16-9 wp-has-aspect-ratio"} -->
    <figure class="wp-block-embed is-type-video is-provider-vimeo wp-block-embed-vimeo wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
    https://vimeo.com/channels/bestofstaffpicks/652309700
    </div></figure>
    <!-- /wp:embed -->

    Thanks

    Plugin Author vaakash

    (@vaakash)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Can’t embed classic Gutenberg block?’ is closed to new replies.