Support

Account

Forum Replies Created

  • I solved the issue… i used the same variable for both filters!

  • hello guys,

    this was a helpful post, but it doesnt quite solve my issue. I have two fields that I would like to add commas. This might be a silly questions, but I am an extreme novice when it comes to PHP.

    I would like to add commas to “price” and the other is “square_footage”.

    The issue I am coming across is when I put both fields “price” & “square_footage”, I get an error, but if I only enter one, it works fine. What am I missing here?

    add_filter('acf/format_value/name=price', 'fix_number', 20, 3);
    function fix_number($value, $post_id, $field) {
      $value = number_format($value);
      return $value;
    	}
    
    add_filter('acf/format_value/name=square_footage', 'fix_number', 20, 3);
    function fix_number($value, $post_id, $field) {
      $value = number_format($value);
      return $value;
    	}
Viewing 2 posts - 1 through 2 (of 2 total)