Execute shortcode within shortcode

I am using this plugin: http://wordpress.org/extend/plugins/worldcurrency/

Shortcode syntax:

[worldcurrency cur="EUR" value="25"] 

However, I’m using Advanced custom fields and the shortcode for custom fields is not being executed within the shortcode for worldcurrency.

[worldcurrency curr="[acf field="fl_currency"]" value="25"]

Any remedies here?

I think I need to be using the



Solutions Collecting From Web of "Execute shortcode within shortcode"

I haven’t tried this, but you could try pseudo-changing the priority of your shortcode hook.

Basically, you force your shortcode to execute before it would normally. That link shows how to execute your shortcode separately – and, more importantly, before – the other shortcodes get implemented.

This works by caching and temporarily removing all existing shortcodes, executing yours, then reestablishing the other shortcodes.

If you look at the ACF shortcode in source (api.php), it just uses the API function get_field on the shortcode’s field attribute.

If you look at the world currency shortcode in source (worldcurrency.php), it outputs a span with the worldcurrency class and a couple of custom attributes, which then get converted on the user side via javascript.

You could probably write your own shortcode that combines the two, using the output of world currency with ACF’s get_field to fetch the attributes from fields you specify.

My answer involves changing the coding of world currency plugin.
Then write the shortcode like this:

[worldcurrency value="25"][acf field="fl_currency"][/worldcurrency]

In the code for the currency plugin, the value of the custom field will be available through the $content field.
Then just set the curr field to $content and you should be good to go.