event date column soartable

This commit is contained in:
magepeopleteam 2020-09-15 05:19:25 +00:00
parent 60af1ee8e1
commit 7bdcd10191
1 changed files with 25 additions and 0 deletions

View File

@ -1303,6 +1303,31 @@ function mep_set_column_soartable( $columns ) {
} }
} }
function mep_remove_date_filter_dropdown( $months ) {
global $typenow; // use this to restrict it to a particular post type
if ( $typenow == 'mep_events' ) {
return array(); // return an empty array
}
return $months; // otherwise return the original for other post types
}
add_filter('months_dropdown_results', 'mep_remove_date_filter_dropdown');
add_action( 'pre_get_posts', 'mep_filter_event_list_by_date' );
function mep_filter_event_list_by_date( $query ) {
if( ! is_admin() )
return;
$orderby = $query->get( 'orderby');
if( 'event_start_datetime' == $orderby ) {
$query->set('meta_key','event_start_datetime');
$query->set('orderby','meta_value');
}
}
// Add the custom columns to the book post type: // Add the custom columns to the book post type:
add_filter( 'manage_mep_events_posts_columns', 'mep_set_custom_edit_event_columns' ); add_filter( 'manage_mep_events_posts_columns', 'mep_set_custom_edit_event_columns' );
// add_filter( 'manage_mep_events_sortable_column', 'mep_set_custom_edit_event_columns' ); // add_filter( 'manage_mep_events_sortable_column', 'mep_set_custom_edit_event_columns' );