I’ve setup a Number field type (price field) and i’m trying to format the number value as:
10500 and a would like it appear as 10.500
<?php
$output = the_field(‘precio’);
$price = number_format( $output, 0, ‘,’, ‘.’);
echo $price;
?>
But it appear the same as without the number_format.
Any suggestion ?
Hey Adriavidal,
Try using:
$output = get_field('precio');
get_field
will return the field value, where as the_field
will echo it.
It would be great to be able to choose formatting of the number field (thousands separator, decimal places) both for the backend and the frontend.
Backend especially, since that’s hard to manipulate with PHP. It could be treated as a ‘Append’/Prepend’ option.
Hi, how to put comma separator into a field?
Please check my question at http://support.advancedcustomfields.com/forums/topic/can-not-input-money-value-in-number-field-type/
I would like to put money value in number field. Bellow are my required values
- 3.55
- 30.55
- 300.55
- 3,000.55
- 30,000.55
Hello everyone.
I need thousands separator in my number input value.
Can anyone help me please?
Try this code:
<?php
$num = get_field(‘your_field’);
$formattedNum = number_format($num).”<br>”;
echo $formattedNum;
?>