隐藏格式化acf字段

时间:2020-07-06 15:58:05

标签: wordpress advanced-custom-fields

我有一个ACF字段(Wordpress)-'part_price'。 使用过滤器将其格式化为“ 123 000”。如果此字段为空,则需要隐藏。

add_filter('acf/format_value/name=part_price', 'fix_number', 20, 3);
 function fix_number($value, $post_id, $field) {
   $value = number_format($value, 0, '', ' ');
   return $value;
 } 
if (get_field('part_price')) {
  // if the field has content then show the field
  the_field($value);
};

但是它不起作用...

0 个答案:

没有答案
相关问题