Forums

Post Snippets
[resolved] How to add shortcode with content (5 posts)

  1. dashaluna
    Member
    Posted 9 months ago #

    Hello,

    How can I add a post snippet that would output a shortcode with the default content and closing tag, like so:
    [quote by="" from=""] Please type the actual quote here. [/quote]

    If I create a post snippet with 2 parameters, then it only outputs [quote by="" from=""] without a closing tag.

    I've tried adding the whole string [quote by="{by}" from="{from}"] Please type the actual quote here. [/quote] to the Snippet field in the admin, but it still only outputs [quote by="" from=""].

    How can I add the whole shortcode with a default content and closing tag.

    Many thanks,
    Dasha

    http://wordpress.org/extend/plugins/post-snippets/

  2. Johan
    Member
    Posted 9 months ago #

    Hi,

    Ah, I see you want to use an enclosing shortcode. At the moment the plugin only supports creating self-closing shortcodes. ie it supports [shortcode attri=""] but not [shortcode attri=""]content[/shortcode].

    Supporting enclosing shortcodes would probably be useful though, so thanks for bringing it up. I'll see if I can include it for the next update.

    Cheers,
    Johan

  3. dashaluna
    Member
    Posted 9 months ago #

    Hey Johan,

    Thanks for letting me know. Yes, that functionality would be really really helpful :)

    Keep me updated on it.

    Thanks,
    Dasha

  4. Johan
    Member
    Posted 9 months ago #

    Hey,

    I just wanted to let you know that I've now updated the plugin to v1.8.2 which can handle enclosed shortcodes. When having text enclosed between the shortcode tags, that text is now available by using {content} in your snippet. The {content] variable is automatically assigned so don't set it in your variables field.

    Cheers,
    Johan

  5. NilsHolmstrom
    Member
    Posted 1 month ago #

    Hi!

    I am wondering if the plugin will support adding closing-shortcode via the TinyMCE-button?

Reply

You must log in to post.

About this Plugin

About this Topic