• I have searched and can’t find anything to fix this issue. I am using event-meta-event-single.php to show a list of ‘Upcoming Events’ but they are in reverse order, ie. the event in December is shown at the top of the list, and the same event in November is below that.

    I want to have the next upcoming event at the top of the list (ASC), not the bottom (DESC).

    Here is the relevant code in event-meta-event-single.php

    
    <?php if ( eo_recurs() ) {
    //Event recurs - display dates.
    $upcoming = new WP_Query(array(
    'post_type'         => 'event',
    'event_start_after' => 'today',
    'posts_per_page'    => -1,
    'event_series'      => get_the_ID(),
    'group_events_by'   => 'occurrence',
    ));
    
    if ( $upcoming->have_posts() ) : ?>
    <br><br><strong><?php _e( 'Upcoming Dates', 'eventorganiser' ); ?>:</strong>
    <ul class="eo-upcoming-dates" style="margin-top:10px">
    <?php
    while ( $upcoming->have_posts() ) {
    $upcoming->the_post();
    echo '<li>' . eo_format_event_occurrence() . '</li>';
    };
    ?>
    </ul>
    						
    <?php
    wp_reset_postdata();
    //With the ID 'eo-upcoming-dates', JS will hide all but the next 5 dates, with options to show more.
    wp_enqueue_script( 'eo_front' );
    ?>
    <?php endif; ?>
    <?php } ?>
    
    <?php do_action( 'eventorganiser_additional_event_meta' ) ?>
    </div>	
    
    
    • This topic was modified 4 years, 2 months ago by jencscc. Reason: formatting code better
    • This topic was modified 4 years, 2 months ago by jencscc.
    • This topic was modified 4 years, 2 months ago by jencscc.
  • The topic ‘Change order of Upcoming Events’ is closed to new replies.