diff --git a/inc/mep_functions.php b/inc/mep_functions.php index 49c0120..829cfc2 100755 --- a/inc/mep_functions.php +++ b/inc/mep_functions.php @@ -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_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' );