k-isabelle
7/12/2018 - 7:19 PM

Add ACF Fields to Admin Columns for Custom Post Type

/*
 * Add columns to exhibition post list
 */
 public function add_acf_columns ( $columns ) {
   return array_merge ( $columns, array ( 
     'start_date' => __ ( 'Starts' ),
     'end_date'   => __ ( 'Ends' ) 
   ) );
 }
 add_filter ( 'manage_exhibition_posts_columns', 'add_acf_columns' );
 
 
/*
 * Add columns to exhibition post list
 */
 public function exhibition_custom_column ( $column, $post_id ) {
   switch ( $column ) {
     case 'start_date':
       echo get_post_meta ( $post_id, 'start_date', true );
       break;
     case 'end_date':
       echo get_post_meta ( $post_id, 'end_date', true );
       break;
   }
 }
 add_action ( 'manage_exhibition_posts_custom_column', 'exhibition_custom_column', 10, 2 );