To add new currency to LearnPress, you need add bellow code to functions.php file in your WordPress theme
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# add currency in to LearnPress
add_filter('learn_press_get_payment_currencies', 'my_cbf_learn_press_get_payment_currencies', 10, 1 ); // for LearnPress 2
add_filter('learn-press/currencies', 'my_cbf_learn_press_get_payment_currencies', 10, 1 ); // for LearnPress 3
add_filter('learn-press/currencies', 'my_cbf_learn_press_get_payment_currencies', 10, 1 ); // for LearnPress 3
function my_cbf_learn_press_get_payment_currencies( $currencies ){
$currency_new = 'MCR'; # Currency Code
$currency_name = __('My Currency (MCR)', 'learnpress'); # Full name of Currency
if( !isset($currencies[$currency_new]) || ( isset($currencies[$currency_new]) && $currencies[$currency_new] !== $currency_name ) ) {
$currencies[$currency_new] = $currency_name;
}
return $currencies;
}
add_filter( 'learn_press_currency_symbol', 'my_cbf_learn_press_currency_symbol', 10, 2 );
function my_cbf_learn_press_currency_symbol( $currency_symbol, $currency ) {
$currency_new = 'MCR'; # Currency Code
if( $currency == $currency_new ) {
$currency_symbol = '<i class="fa fa-thumbs-up"></i>'; # Symbol of currency
}
return $currency_symbol;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Results:
Không có nhận xét nào:
Đăng nhận xét