• Resolved Ericmuc

    (@ericmuc)


    Hi,
    I suggest to change code in the Register.php to allow shortcodes in the blocks:
    Would be great if you can add this in the plugin, so that this is update save.
    Thanks, kind regards
    Eric

    $content = '';
    foreach ( $blocks as $block ) {
    if( 'core/embed' === $block['blockName'] ){
    $content .= apply_filters( 'the_content', render_block( $block ) );
    }else{

    // $content .= render_block( $block );
    $content .= do_shortcode(render_block( $block ));
    }
    }
    $content = apply_filters('the_content', $content);
    return wp_kses( $content, $allowedHTML );
    }
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Plugin Envision Support

    (@pluginenvisionsupport)

    Hi,

    We will note that and let you know.

    Thank you!

    Thread Starter Ericmuc

    (@ericmuc)

    Hi,
    Today I had to extend the Register.php with this code after line 113 for for using further elements:
    Please check (may be it has to be improved further) and please add it into the core if possible.
    Thanks, kind regards
    Eric

    $allowedHTML['form'] = [
    'action' => 1,
    'method' => 1,
    'enctype' => 1,
    'class' => 1,
    'id' => 1,
    'data-*' => 1
    ];

    $allowedHTML['select'] = [
    'name' => 1,
    'id' => 1,
    'class' => 1,
    'data-*' => 1
    ];

    $allowedHTML['option'] = [
    'value' => 1,
    'selected' => 1,
    'class' => 1
    ];

    $allowedHTML['input'] = [
    'type' => 1,
    'name' => 1,
    'value' => 1,
    'id' => 1,
    'class' => 1,
    'checked' => 1,
    'data-*' => 1
    ];

    $allowedHTML['label'] = [
    'for' => 1,
    'class' => 1
    ];

    $allowedHTML['button'] = [
    'type' => 1,
    'class' => 1
    ];
    Thread Starter Ericmuc

    (@ericmuc)

    Hi again,
    My SVG is currently displaying only in black instead of its intended colors. It would be great if this could be improved.

    Thanks and best regards,
    Eric

    Plugin Support Plugin Envision Support

    (@pluginenvisionsupport)

    Hi @ericmuc,

    We have added support for the form, select, option, input, and other tags. Additionally, we have included the core/shortcode block condition for your first message. A new version has been released, so please update the plugin to the latest version and let us know if it works properly.

    Thank you!

    Thread Starter Ericmuc

    (@ericmuc)

    Hi there,
    thanks for the recent update – it looks great!
    However, I noticed that shortcodes are currently not working properly in the new version.

    At the moment, only core/shortcode blocks are passed through do_shortcode(), but shortcodes inside other blocks (like paragraphs or columns) are no longer executed.

    Also, the final $content doesn’t seem to be passed through apply_filters( 'the_content', $content ), which is normally essential for processing shortcodes, oEmbeds, and other content filters.

    Would it be possible to adjust this in a future update?

    Here’s a version that works well on our end:

    foreach ( $blocks as $block ) {
    if ( 'core/embed' === $block['blockName'] ) {
    $content .= apply_filters( 'the_content', render_block( $block ) );
    } else {
    $content .= do_shortcode( render_block( $block ) );
    }
    }

    // Make sure the full content runs through standard WP filters (shortcodes, embeds, etc.)
    $content = apply_filters( 'the_content', $content );

    return wp_kses( $content, $allowedHTML );

    Thanks a lot for looking into it – and for your great work on this plugin!

    Plugin Support Plugin Envision Support

    (@pluginenvisionsupport)

    Hi @ericmuc,

    We have updated the code without a version update. You can try it now.

    If everything goes right, the updated code will persist. If other users have issues, we will return to the previous code.

    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Allow shortcodes in the blocks’ is closed to new replies.