2021年4月11日日曜日

改 Events Managerの価格表示の小数点以下「.00」を消す方法【WordPressプラグイン】

Events Managerの価格表示の小数点以下「.00」を消す

を探すと

https://jun1ch.com/events-manager00

http://kumakake.com/wordpress/3226

が出てきますが2021年4月11日現在 コードが変わっています。


でテーマファイルを触らない解決策はこれ こっちのほうが良い

https://nkmrkisk.com/archives/1883


テーマファイルを触るのはこれ

https://qiita.com/buchi014/items/e78ef3a8ca4e4021c90d


/(ドメイン名)/public_html/wp-content/plugins/events-manager/em-functions.php

このファイルの229行目

$precision = 2 を $precision = 0に変更します。

function em_get_currency_formatted($price, $currency=false, $format=false, $precision = 0){

function em_get_currency_formatted($price, $currency=false, $format=false, $precision = 2){


    $formatted_price = '';

    if(!$format) $format = get_option('dbem_bookings_currency_format','@#');

    if(!$currency) $currency = get_option('dbem_bookings_currency');

    $formatted_price = str_replace('#', number_format( $price, $precision, get_option('dbem_bookings_currency_decimal_point','.'), get_option('dbem_bookings_currency_thousands_sep',',') ), $format);

    $formatted_price = str_replace('@', em_get_currency_symbol(true,$currency), $formatted_price);

    return apply_filters('em_get_currency_formatted', $formatted_price, $price, $currency, $format);

}

 

0 件のコメント:

コメントを投稿

TasteWP の「サイトの設定に成功しました」を非表示にする方法【Stylish活用】

TasteWP の通知が問題になる理由 TasteWP で作成した WordPress サイトでは、管理画面の上部に「サイトの設定に成功しました」という通知が表示されます。 しかし、この通知には自動で消える機能がないため […] 投稿元: Microsoft Power Auto...