Skip to content

Instantly share code, notes, and snippets.

@dancameron
Created May 22, 2018 15:47
Show Gist options
  • Save dancameron/f5596da437b930dfee29e928bd3d02f3 to your computer and use it in GitHub Desktop.
Save dancameron/f5596da437b930dfee29e928bd3d02f3 to your computer and use it in GitHub Desktop.
Adding new Currency Local (Example: Naira)
<?php // don't include this line in your functions.php, since it already starts with it.
function _si_add_local_for_client( $client_fields = array() ) {
$client_fields['money_format']['options']['ngn'] = 'Naira';
return $client_fields;
}
add_filter( 'si_client_adv_form_fields', '_si_add_local_for_client' );
function _si_set_localeconv( $localeconv = array(), $locale = '' ) {
switch ( $locale ) {
case 'ngn':
$localeconv = ngn_local_array();
break;
}
return $localeconv;
};
add_filter( 'si_localeconv', '_si_set_localeconv', 10, 2 );
function ngn_local_array() {
return array(
'decimal_point' => '.',
'thousands_sep' => '',
'int_curr_symbol' => 'NGN',
'currency_symbol' => '₦',
'mon_decimal_point' => '.',
'mon_thousands_sep' => ',',
'positive_sign' => '',
'negative_sign' => '-',
'int_frac_digits' => 2,
'frac_digits' => 2,
'p_cs_precedes' => 1,
'p_sep_by_space' => 0,
'n_cs_precedes' => 1,
'n_sep_by_space' => 0,
'p_sign_posn' => 1,
'n_sign_posn' => 1,
'grouping' => array(),
'mon_grouping' => array( 3, 3 ),
);
}
@dancameron
Copy link
Author

This snippet is a customization for Sprout Invoices. A customizable solution that provides a way for you to get paid via your WordPress site. For more information please don't hesitate to reach out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment