Viewing 1 replies (of 1 total)
  • Plugin Author benz1

    (@benz1)

    Hi Ricki,

    I passed this onto my developer who replied as follows:

    Shortcodes can be embedded in content blocks, for example, if you have a shortcode definition like this:

    function caption_shortcode( $atts, $content = null ) {
       return '<span class="caption" style="color:red;">' . $content . '</span>';
    }
    add_shortcode( 'caption', 'caption_shortcode' );

    it can be used directly in a post like this:
    [caption]this is a test[/caption]
    and will return
    <span class="caption" style="color:red;">this is a test</caption>

    You can also use it in a content block, like this:
    – create a new block (can be any type)
    – add something along these lines:
    this is a test block; here is a caption: [caption]this is a test[/caption]
    this will output, when run (either via do_shortcode or when viewed in page):
    this is a test block; here is a caption:<span class="caption" style="color:red;">this is a test</caption>

    So, both types of shortcodes are supported (enclosed or not).

    You have to remember that shortcodes do not execute other shortcodes that are in their content by default, so the fact that this plugin does is by design (check https://codex.www.ads-software.com/Shortcode_API).

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Global Content Blocks] Feature request – allow for content between open and close tag’ is closed to new replies.