Skip to content

Instantly share code, notes, and snippets.

@pbrocks
Forked from travislima/pmpro_eu_dkk_format.php
Last active October 9, 2018 15:21
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 pbrocks/c3eecf2b5bb71110752a0d8c26bd7183 to your computer and use it in GitHub Desktop.
Save pbrocks/c3eecf2b5bb71110752a0d8c26bd7183 to your computer and use it in GitHub Desktop.
Change EU Danish Krone currency format for Paid Memberships Pro.
<?php // do not include in Customizations plugin if copying and pasting
/**
* Plugin Name: Add a Currency to global
*
* This code gist illustrates a way to customize the format of how your currency displays.
*
* In this example, we will change the PMPro Danish Krone currency
*
* from DKK 1,495.00
* to DKK 1 495,00
*
* Adjust this code gist to suit your needs for currency.
*
* Currency information can be found in this core plugin file `/paid-memberships-pro/includes/currencies.php`
*
* Add this code below to your PMPro Customizations Plugin
* - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
/**
* pmpro_eu_dkk_format This function changes the values of a specific keys for a currency in the `$pmpro_currencies` array.
*
* @param array $pmpro_currencies The currency array created by PMPro
* @return array The adjusted currency array
*/
function pmpro_eu_dkk_format( $pmpro_currencies ) {
$pmpro_currencies['DKK'] = array(
'name' => __( 'Danish Krone', 'paid-memberships-pro' ),
'decimals' => '2',
'thousands_separator' => '&nbsp;',
'decimal_separator' => ',',
'symbol' => 'DKK&nbsp;',
'position' => 'left',
);
return $pmpro_currencies;
}
add_filter( 'pmpro_currencies', 'pmpro_eu_dkk_format' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment