Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Snippet now hosted here: https://gist.github.com/elimn/a5843c2723a04866e593
- add_filter('posts_orderby', 'custom_events_search_orderby', 1);
- add_action( 'admin_menu', 'custom_admin_menu', 1 );
- function custom_admin_menu () {
- add_submenu_page(
- '/edit.php?post_type='.TribeEvents::POSTTYPE,
- 'Events: Upcoming',
- 'Events: Upcoming',
- apply_filters( 'tribe_settings_req_cap', 'manage_options' ),
- 'edit.php?post_type='.TribeEvents::POSTTYPE.'&orderby=start-date&order=asc&upcoming-events=true'
- );
- }
- function custom_events_search_orderby ( $orderby_sql ) {
- global $ecp_apm;
- if (!empty($_GET['upcoming-events']) && get_query_var('post_type') == TribeEvents::POSTTYPE) {
- $ecp_apm->filters->add_active(
- array('ecp_end_date' =>
- array(
- 'value' => date('Y-m-d'),
- 'is' => 'gte',
- 'is_date_field' => true
- )
- )
- );
- }
- return $orderby_sql;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement