Home › Forums › General Issues › How to create "table of (numeric input) fields" › Reply To: How to create "table of (numeric input) fields"
// Upon *new* post only
add_filter('acf/load_value/key=field_5ff3a123b5198', 'build_participants_table', 20, 3);
....
function build_participants_table($value, $post_id, $field){
//error_log('build_participants_table field='. print_r($field, true));
$ptypes = array(/* participants segments*/ 'men', 'women', 'children'); // etc...
foreach ($ptypes as $ptype){
$value[] = array(
'field_5ff3c5f44a5d1' => $ptype,
'field_5ff3c4debd753' => 0,
'field_5ff3c514bd754' => 0,
'field_5ff3c52abd755' => 0,
'field_5ff3c543bd756' => 0,
);
}
return $value;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.