Home › Forums › General Issues › Formatting number fields using format_value › Reply To: Formatting number fields using format_value
Hi there John,
Could you help me? I’m trying to display commas in number type field, like so:
120,000
I tried some combinations of code I found in different threads, but nothing worked really!
I have a particular field I want to format the numbers for, (listing_price).
I also tried:
add_filter('acf/format_value/number=listing_price', 'fix_number', 20, 3);
function fix_number($value, $post_id, $field) {
$value = number_format($value);
return $value;
}
but nothing happened.
What do the numbers 20 and 3 mean above?
I thought I’d need to replace them with my case for example 20000 (as currently displayed), to 20,000 as I want them displayed.
In any case, code doesn’t work.
Can you suggest something?
Thank you for any help!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.