<?php //remove opening php tag
// add column(s) to admin cpt ui
add_filter ( 'manage_cptname_posts_columns', 'wd_add_acf_columns' );
function wd_add_acf_columns ( $columns ) {
return array_merge ( $columns, array (
'additional_column_1' => __ ( 'Column 1 Label' ),
'additional_column_2' => __ ( 'Column 2 Label' ),
));
}
// add data to column(s)
add_action ( 'manage_cptname_posts_custom_column', 'wd_cptname_custom_column', 10, 2 );
function wd_cptname_custom_column ( $column, $post_id ) {
switch ( $column ) {
case 'additional_column_1':
$acf_value_1 = get_field( 'acf_value_1' );
echo $acf_value_1;
break;
case 'additional_column_2':
$acf_value_2 = get_field( 'acf_value_2' );
echo $acf_value_2;
break;
}
}