カスタムフィールドで金額を入力する項目を出力する際に、自動で3桁区切りでカンマをつけたいことがあったのでメモ
。
PHPのnumber_format();
を使用する
<?php
$price = number_format(get_field('フィールド名'));
$minute = get_field('フィールド名');
echo "¥{$price} / {$minute}min";
?>
参考記事 → https://www.web-myoko.net/blog/wordpress/comma-separated-number-advanced-custom-fields-wordpress/