WordPress.org

Ideas

Allow shortcodes to have shortcodes in attributes

  1. Andrés Sanhueza
    Member

    12345

    I think that shortcodes should work when used inside attributes of other shortcodes, just like they can work inside the "$content" of a shortcode.

    Some people says that it isn't supposed to work, but theoretically is supposed to work when using the "do_shortcode" function. It don't work because:

    1) "do_shortcode is context free, which it's fine by its fastness althought don't allow stuff like inserting a shortcode inside the content of itself

    2) The shortcode regex stops with the first occurrence of a ] in a shortcode, so in this:

    [foo bar="[baz /]"]content[/foo]

    it "outputs":

    [foo bar="[baz /]

    and "]content[/foo] is ignored.
    I'm not programmer but I tried to fix it by changing the shortcode regex so it allow anything between quotes or brackets inside the first group of brackets. It sort of works, but also mess the handling of quotes in the rest of the shortcode, so I think something more advanced have to be done to make it work.

    Posted: 4 years ago #

RSS feed for this topic

Reply

You must log in to post.

  • Rating

    12345
    5 Votes
  • Status

    Sorry, not right now

Tags