[wp-hackers] Shortcode embedded within shortcode -- is it possible?

Brian Layman wp-hackers at thecodecave.com
Tue Aug 9 18:25:25 UTC 2011

This may be obvious, but it should be helpful for you to test the short 
codes separately first, making sure each works as expected individually.

Additionally, if you need to bandaid the process, you could make the 
inner short code brackets [] be braces {} and convert them to brackets 
via the outer short code's processing.

So you start with something like this:

causing one of the parameters to be

{s3signedlink url=https://s3.amazonaws.com/mybucket/myvideo.mp4}

which gets converted to

[s3signedlink url=https://s3.amazonaws.com/mybucket/myvideo.mp4]

and processed as a short code.

I don't know if that will help or not, but it might give you a direction 
to go...

On 8/9/2011 11:15 AM, Claude Needham wrote:
> The real world problem is a need to use aws s3 signed urls with
> existing flowplayer plugin.
> I offered code to flowplayer that would allow them to transparently
> handle the s3 signed urls, but since there is still only a small
> community of folks with a need for this feature, they were
> understandably hesitant to take new code under their wing.
> So my need is to find a way to dynamically refactor the video url at
> runtime (during each page view). This is because the signed urls
> typically have a 60 minutes lifetime.
> I tried just putting a shortcode inside the other shortcode.
> [FLOWPLAYER=http://domain.com/splash.jpg|[s3signedlink
> url=https://s3.amazonaws.com/mybucket/myvideo.mp4],600,450]
> That was a fail. Worth a try. But, at the time did not work for me. I
> don't know php well enough yet to determine if the core shortcode
> handler can deal with inline shortcodes within other shortcodes.
> The note in wp-includes/shortcodes.php seems to indicate that the
> simplistic approach will not work.
> 13	 * Shortcode tags support attributes and enclosed content, but does
> not entirely
> 14	 * support inline shortcodes in other shortcodes. You will have to call the
> 15	 * shortcode parser in your function to account for that.
> 17	 * {@internal
> 18	 * Please be aware that the above note was made during the beta of
> WordPress 2.6
> 19	 * and in the future may not be accurate. Please update the note
> when it is no
> 20	 * longer the case.}}
> So I'm looking for a clue on how to approach this. I'm a bit new to
> php and much of the codex assumes more than the sparse background I
> have currently.
> Perhaps there is a hook or filter I can use that would allow me to get
> at the video url in the flowplayer shortcode before it is processed.
> Thanks for any hints.
> Regards,
> Claude Needham
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

Brian Layman
Managed WordPress Hosting

More information about the wp-hackers mailing list