This plugin will convert currencies within the text of a post or page.
Once the plugin is activated a new option will appear, named Currency Converter, on the left sidebar menu in the Administration screen. Under this are a number of sub-options...
Before using this plugin it is highly recommended that you review the Options screen and change any values, as appropriate. You will also need to sign up for and enter an App Key before conversions will work - see the next section.
Open Exchange Rates now requires an App Key to be specified. This is to prevent over-use of the exchange system and to provide premium features.
A free plan is available and this plugin should not cause your usage to be exceeded. Premium plans are also available - as features are added to these they will be added to this plugin. For the time being, however, having a premium plan does not add any extra features to this plugin.
To get your App Key sign up on the Open Exchange Rates site for the plan that best suits your need. Now head to the Currency Converter options screen and enter the App Key into the appropriate field. Save the results.
The shortcode of '[convert]' has the following parameters that you may specify...
Example of use are...
[convert number=49.99 from="gbp" to="usd"]
This would convert 49.99 from UK pounds to US dollars and output the result to 2 decimal places.
[convert number=50 from="usd" to="gbp"]
This would convert 50 from US dollars to UK pounds and output the result without any decimal places.
If the conversion can't be done then an appropriate error message will be output instead. If you wish to suppress these messages then you need to use a template (see the later section on this) - in this case no output will be generated in the case of an error.
The template option allows you to specify other information to be output along with the conversion result. None of the template will be output if any error occurs, including any error messages, allowing you to suppress any conversion text in the case of a problem.
The template text must include
%result% where you wish the output to appear.
Here's an example...
Normally, this would print a result such as...
However, if an error occurs then it will print as...
You may also include the template between opening and closing shortcode tags. For example...
If you wish to perform a currency conversion within your theme, rather than within a post or page, then you can use a PHP function call. The function name is
get_conversion and will return the result back.
<?php echo get_conversion( 'number=49.99&from=gbp&to=usd' ); ?>
For the use of developers, 2 global variables have been added which, if assigned within your site code, will override the conversion codes.
The variables are
This is useful if, say, you have multiple versions of the site in different languages - you can then assign these global variables depending on which site is being viewed and all currency will be converted based upon these settings.
These will only override the options screen and not specific parameters specified with a shortcode or function call.
This WordPress plugin is licensed under the GPLv2 (or later).
All of my plugins are supported via my website.
Please feel free to visit the site for plugin updates and development news - either visit the site regularly or follow me on Twitter (@artiss_tech).
For problems, suggestions or enhancements for this plugin, there is a dedicated page. The dedicated page will also list any known issues and planned enhancements.
This plugin, and all support, is supplied for free, but donations are always welcome.