Support

Account

Home Forums General Issues Number field type thousand separator

Solving

Number field type thousand separator

  • 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 ?

  • the_field() echos the field value and does not return a value, you need to use get_field()

    
    $output = get_field('precio');
    $price = number_format( $output, 0, ',', '.');
    echo $price;
    
  • 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’); VidMate
    $price = number_format( $output, 0, ‘,’, ‘.’);
    echo $price;
    ?>

    But it appear the same as without the number_format.

    Any suggestion ?
    issue got solved!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.