Notifications
Clear all
Topic starter 25/01/2022 11:41 am
Add the following piece of code in your themes functions.php
/* * Add columns to exhibition post list */ function add_acf_columns ( $columns ) { return array_merge ( $columns, array ( 'lc_event_start_date' => __ ( 'Starts' ), 'lc_event_end_date' => __ ( 'Ends' ) ) ); } add_filter ( 'manage_local_events_posts_columns', 'add_acf_columns' ); /* * Add columns to exhibition post list */ function local_events_custom_column ( $column, $post_id ) { switch ( $column ) { case 'lc_event_start_date': echo date('m-d-Y', strtotime( get_post_meta ( $post_id, 'lc_event_start_date', true ) ) ).' '.get_post_meta ( $post_id, 'lc_event_start_time', true ); break; case 'lc_event_end_date': $time = get_post_meta ( $post_id, 'lc_event_end_date', true ); if( !empty($time)) { echo date('m-d-Y', strtotime( $time ) ).' '.get_post_meta ( $post_id, 'lc_event_end_time', true ); } break; } } add_action ( 'manage_local_events_posts_custom_column', 'local_events_custom_column', 10, 2 );
Topic starter 25/01/2022 11:42 am
Add the following piece of code in your themes functions.php
/* * Add columns to exhibition post list */ function add_acf_columns ( $columns ) { return array_merge ( $columns, array ( 'lc_event_start_date' => __ ( 'Starts' ), 'lc_event_end_date' => __ ( 'Ends' ) ) ); } add_filter ( 'manage_local_events_posts_columns', 'add_acf_columns' ); /* * Add columns to exhibition post list */ function local_events_custom_column ( $column, $post_id ) { switch ( $column ) { case 'lc_event_start_date': echo date('m-d-Y', strtotime( get_post_meta ( $post_id, 'lc_event_start_date', true ) ) ).' '.get_post_meta ( $post_id, 'lc_event_start_time', true ); break; case 'lc_event_end_date': $time = get_post_meta ( $post_id, 'lc_event_end_date', true ); if( !empty($time)) { echo date('m-d-Y', strtotime( $time ) ).' '.get_post_meta ( $post_id, 'lc_event_end_time', true ); } break; } } add_action ( 'manage_local_events_posts_custom_column', 'local_events_custom_column', 10, 2 );
Replace "local_events" with your custom post slug.
And, "lc_event_end_date" are ACF fields.