Dynamic Column Creation with PHP
Hello!
I used the PHP Export as a template to dynamically generate columns…
… it “sorta” works… the problem is… it is creating a unique column “set” (Import, Import #1, etc.) for every column.
Can you tell me what the issue is with my loop please?
Here is the code within my loop used to “push” a new column’s settings into the array:
( it does this 67 times in my case, so therefore is creating 67 “Import Column sets” )
$cc_ac_columns[] = array('columns' => array($row['column_name'] => array(
'type' => $row['column_type'],
'label' => $row['column_label'],
'width' => '',
'width_unit' => '%',
'field' => $row['acf_field_key'],
'character_limit' => '20',
'edit' => $column_edit_setting,
'sort' => $row['allow_sorting'],
'filter' => $column_filter_setting,
'filter_label' => '',
'name' => $row['column_name']
),),);
And here’s how I am registering it…
ac_register_columns( 'projects', $cc_ac_columns );
You must be logged in to reply to this topic.