/**
* Sorts the list of currencies displayed on the currency selector widget.
*
* HOW TO USE THIS CODE
* Add the code to the bottom of your theme's functions.php file, and it
* will run automatically. For more information: https://www.skyverge.com/blog/add-custom-code-to-wordpress/
*
* GPL DISCLAIMER
* Because this code program is free of charge, there is no warranty for it, to the extent permitted by applicable law.
* Except when otherwise stated in writing the copyright holders and/or other parties provide the program "as is"
* without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of
* merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program
* is with you. should the program prove defective, you assume the cost of all necessary servicing, repair or correction.
*
* Need a consultation, or assistance to customise this code? Find us on Codeable: https://aelia.co/hire_us
*
* @param array currencies An array of currencies passed by the widget.
* @param string widget_type The type of widget beind displayed (e.g. 'dropdown' or 'buttons').
* @param string widget_title The widget title
* @param string widget_template_name The template file that is going to be used to render the widget.
* @return array
*/
function custom_sort_currencies($currencies, $widget_type, $widget_title, $widget_template_name) {
// Sort the list of currencies before returning it
$sorted_currencies = array(
'USD' => $currencies['USD'],
'GBP' => $currencies['GBP'],
'EUR' => $currencies['EUR'],
);
return $sorted_currencies;
}
add_filter('edd_aelia_currencyswitcher_widget_currency_options', 'custom_sort_currencies', 10, 4);
Comments