I have this function code, that brings in a ACF date picker data, and adds it to the columns view. It;s raw format is YYYYMMDD
My next step is to change the format of the date to, Day Month Year so it's more legible and if possible have the column sort-able by ascending and descending date.
Probably asking too much, can anyone help? and educate me a bit too :-)
/*
* Add columns to event post list
*/
function add_acf_columns ( $columns ) {
return array_merge ( $columns, array (
'event_date' => __ ( 'Event Date' ),
) );
}
add_filter ( 'manage_events_posts_columns', 'add_acf_columns' );
/*
* Add columns to event event list
*/
function events_custom_column ( $column, $post_id ) {
switch ( $column ) {
case 'event_date':
echo get_post_meta ( $post_id, 'event_date', true );
break;
}
}
add_action ( 'manage_events_posts_custom_column', 'events_custom_column', 10, 2 );
I have this function code, that brings in a ACF date picker data, and adds it to the columns view. It;s raw format is YYYYMMDD
My next step is to change the format of the date to, Day Month Year so it's more legible and if possible have the column sort-able by ascending and descending date.
Probably asking too much, can anyone help? and educate me a bit too :-)
/*
* Add columns to event post list
*/
function add_acf_columns ( $columns ) {
return array_merge ( $columns, array (
'event_date' => __ ( 'Event Date' ),
) );
}
add_filter ( 'manage_events_posts_columns', 'add_acf_columns' );
/*
* Add columns to event event list
*/
function events_custom_column ( $column, $post_id ) {
switch ( $column ) {
case 'event_date':
echo get_post_meta ( $post_id, 'event_date', true );
break;
}
}
add_action ( 'manage_events_posts_custom_column', 'events_custom_column', 10, 2 );
Hope this code may be help you
<?php
/*
* Add columns to event post list
*/
function add_acf_columns ( $columns ) {
return array_merge ( $columns, array (
'event_date' => __ ( 'Event Date' ),
));
}
add_filter ( 'manage_events_posts_columns', 'add_acf_columns' );
/*
* Add columns to event event list
*/
function events_custom_column ( $column, $post_id ) {
switch ( $column ) {
case 'event_date':
$event_date = get_post_meta ( $post_id, 'event_date', true );
echo $fDate = date("d-m-Y", strtotime($event_date));
break;
}
}
add_action ( 'manage_events_posts_custom_column', 'events_custom_column', 10, 2 );
?>