• Resolved Sara99

    (@sara99)


    Hi there!
    Currently, the events of this page https://bacwa.org/ (third column) are displayed by the event published date order desc. I’d like them to be published by the event start date order asc. How can I do that? I am using a WP_Query.
    Thank you!
    Sara

    • This topic was modified 2 years, 9 months ago by Sara99.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Sara99

    (@sara99)

    I am using this code but it’s not working. What arguments and value can I use instead?
    $args[‘post_type’] = ‘tribe_events’;
    $args[‘start_date’] = ‘now’;
    $args[‘orderby’] = ‘_start_date’;
    $args[‘order’] = ‘ASC’;

    For event start date use _EventStartDate. This will solved problem,

    I used this function

    function( $query ) {
    $meta_query = (array)$query->get( 'meta_query' );
        $query->set( 'meta_query', $meta_query );
    	$query->set( ‘orderby’, ‘meta_value’ );
    	$query->set( ‘meta_key’, ‘_EventStartDate’ );
    	$query->set( ‘order’, ‘ASC’ );
    });
    Thread Starter Sara99

    (@sara99)

    Thanks for your reply!
    I don’t know how to use this code in my code…

    I am doing this to build my list of events:

    $args = array(‘posts_per_page’ => 7);
    $args[‘post_type’] = ‘tribe_events’;

    How can I use your code in my code?
    Thank you!
    Sara

    Hi there,

    You could make use of our Events List widget to achieve the results you want. You can read more about it here: https://theeventscalendar.com/knowledgebase/k/configuring-the-event-list-widget/

    Best regards,

    Marho

    Plugin Support masoodak

    (@masoodak)

    Hi there,

    This thread has been pretty quiet for a while, so we’re going to go ahead and close it. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Have a great day.

    Kind regards,
    Masood

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display events in start date order instead of published date order’ is closed to new replies.