我有一个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);
};
但是它不起作用...