Created
May 20, 2019 08:34
-
-
Save manchumahara/3e0c286bfc2d838270ab7d52cd93bb8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: CBX Accounting Override | |
Plugin URI: https://codeboxr.com | |
Description: CBX Accounting Override | |
Author: Codeboxr | |
Version: 1.0.0 | |
Author URI: https://codeboxr.com | |
Text Domain: cbxaccountingoverride | |
Domain Path: /languages/ | |
*/ | |
// If this file is called directly, abort. | |
if (!defined('WPINC')) { | |
die; | |
} | |
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