Pages Navigation Menu

WP Admin custom column

/*
 * 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 );

Leave a Reply