Support » Plugin: AM Events » Admin sorting by start date & separate listing of passed events

  • Hi there,

    Wondering if it’s possible to make the admin view of the events have a default of sorting by start date.

    As it currently stands, the events are sorted by the date they were posted on, which is not particularly helpful.

    While I’m at it I’ll throw in another feature request: Have all passed events be hidden from the default event listing and moved to a listing on a separate page for “Passed Events.”

    Please understand that this are minor gripes with an otherwise amazing plugin. If there is any way I can help with the implementation of these features please let me know. Keep up the great work!

    https://wordpress.org/plugins/am-events/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Atte Moisio

    (@moisture)

    Hey,

    Sure it’s possible. Adding the following to your functions.php should do the trick:

    if(is_admin()) {
      add_action('pre_get_posts','am_set_default_admin_event_order');
    }
    
    function am_set_default_admin_event_order( $query ) {
      if( is_post_type_archive('am_event') && !isset( $_GET[ 'orderby' ] ) ) {
        $query->set( 'post_type', 'am_event' );
        $query->set( 'meta_key', 'am_startdate' );
        $query->set( 'orderby', 'meta_value' );
        $query->set( 'order', 'ASC' );
      }
    }
    Plugin Author Atte Moisio

    (@moisture)

    I actually just realized that the fix above won’t really be useful without the separate page for passed events :). However, an actual calendar page like this would probably be even more useful.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Admin sorting by start date & separate listing of passed events’ is closed to new replies.