In functions.php

function add_acf_columns ( $columns ) {
   return array_merge ( $columns, array ( 
     'start' => __ ( 'Start' ),
     'eind'   => __ ( 'Eind' ) 
   ) );
 }
add_filter ( 'manage_edit-agenda_columns', 'add_acf_columns' );

/*
* Add content to forum post list column
*/
function forum_custom_column ( $column, $post_id ) {
   switch ( $column ) {
     case 'start':
       $start = get_field( 'start', $post_id );
       setlocale(LC_TIME, 'nl_NL');
       echo strftime("%d %B %Y %H:%M", strtotime($start));
       break;
     case 'eind':
       $eind = get_field( 'eind', $post_id );
       setlocale(LC_TIME, 'nl_NL');
       echo strftime("%d %B %Y %H:%M", strtotime($eind));
       break;
   }
 }
add_action ( 'manage_agenda_posts_custom_column', 'forum_custom_column', 10, 2 );

add_filter( 'manage_edit-agenda_sortable_columns', 'my_sortable_cake_column' );
function my_sortable_cake_column( $columns ) {
    $columns['start'] = 'start';
	$columns['eind'] = 'eind';
    //To make a column 'un-sortable' remove it from the array
    //unset($columns['date']);
 
    return $columns;
}

 

Geef een reactie 0