Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi David,

    If you change “args[‘order’] = ‘ASC’;” to “args[‘order’] = ‘DESC’;”

    Would that give you what you need?

    Thread Starter The Stash House

    (@stashhouse)

    Hi Drew,

    thanks for your help,

    it was a little less obvious than that ??

    /**
    * Reorder events so that the older events are on top in list view
    */
    add_action( 'pre_get_posts', 'my_reorder_events', 500 );
    function my_reorder_events( $query ) {
        if ( tribe_is_view('list') ) {
            $query->set( 'orderby', 'meta_value' );
            $query->set( 'meta_key', '_EventStartDate' );
            $query->set( 'order', 'DESC' );
        }
        return $query;
    }

    Cheers,

    David

    Thread Starter The Stash House

    (@stashhouse)

    it’s better this way :

    if ( tribe_is_view('list') && $query->is_main_query() ) {

    ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Order of events in the list view’ is closed to new replies.