Skip to content

Instantly share code, notes, and snippets.

@manchumahara
Last active May 20, 2019 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manchumahara/6a432b33c7422c803822cfb1dffc5f7e to your computer and use it in GitHub Desktop.
Save manchumahara/6a432b33c7422c803822cfb1dffc5f7e to your computer and use it in GitHub Desktop.
How to add Mongolian tögrög to CBX Accounting
add_filter('cbxwpsimpleaccounting_currencies', 'cbxwpsimpleaccounting_currencies_custom_currency');
//how to add new currency
/**
* Add new currency
*
* @param array $currency_arr
*
* @return array
*/
function cbxwpsimpleaccounting_currencies_custom_currency($currency_arr){
//at first check if the same currency code is added before
if(!isset($currency_arr['MNT'])){
$currency_arr['MNT'] = 'Mongolian tögrög';
}
return $currency_arr;
}
//how to add symbol for the new currency
add_filter('cbxwpsimpleaccounting_currency_symbol','cbxwpsimpleaccounting_currency_symbol_mnt', 10, 2);
function cbxwpsimpleaccounting_currency_symbol_mnt($currency_symbol, $currency_code){
if($currency_code == 'MNT') return '$₮'; // where 'MNT' is your known currency code and '$₮'' is your known currency symbol
return $currency_symbol;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment