Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

Update
I think I need to be using the

add_filter('xx','do_shortcode');

somehow?

share|improve this question
    
Have you attempted to post at the plugin's support page? wordpress.org/support/plugin/worldcurrency –  Stephen Feb 4 '13 at 18:48
    
i will but there usually no replies there.. –  Andy Jonathan Feb 4 '13 at 19:38
    
Did you made any progress on this issue since feb 4/5? –  Mike Madern Jul 8 '13 at 9:54
add comment

3 Answers 3

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.

share|improve this answer
    
Sounds promising but i dont have the skills to do this on my own I am afraid. –  Andy Jonathan Feb 5 '13 at 2:15
add comment

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.

share|improve this answer
    
wouldn't this slow down the web page speed significantly? –  Andy Jonathan Feb 5 '13 at 2:14
    
As I said, I haven't tried it, but I don't see anything obvious in the example code that would make a significant difference in speed. As far as I can tell, it simply copies the variable containing the preexisting shortcodes (probably just a simple array), removes them en masse (which shouldn't be a significant slow-down) using remove_all_shortcodes(), creates your shortcode, then copies the old shortcodes variable back. –  akTed Feb 5 '13 at 2:47
    
Just found where WP does the same thing for the [embed] shortcode, since it too needs to run earlier. In WP 3.5, in wp-includes/class-wp-embed.php line 50 is the method run_shortcode(). The example I linked too is nearly identical (including code comments). So it would appear this is The WordPress Way to do it. –  akTed Feb 5 '13 at 3:03
add comment

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.

share|improve this answer
    
the value 25 is going to be a custom field as well so this makes things more difficult. –  Andy Jonathan Feb 4 '13 at 19:38
    
Making changes in plugins isn't encouraged. When you update the plugin the changes that were made would be overwritten. –  Mike Madern Jul 8 '13 at 8:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.