public function testOndateSlug()
 {
     global $wp_rewrite;
     update_option('permalink_structure', '/%year%/%monthnum%/%day%/%postname%/');
     $options = eventorganiser_get_option(false);
     $options['url_on'] = 'events-on';
     update_option('eventorganiser_options', $options);
     eventorganiser_cpt_register();
     $GLOBALS['wp_rewrite']->init();
     flush_rewrite_rules();
     $this->go_to(eo_get_event_archive_link(2014, 03));
     $this->assertTrue(eo_is_event_archive('month'));
     $this->assertEquals('2014-03-01', eo_get_event_archive_date('Y-m-d'));
     $this->assertEquals('http://example.org/events/event/events-on/2014/03', eo_get_event_archive_link(2014, 03));
 }
<div class="container">
    <div class="row">
    	<div class="col-md-8">
            <!-- <div id="primary" role="main" class="content-area"> -->
            
                	<!-- Page header-->
                    <h2 class="chesterRed entry">
                    
                    <?php 
if (eo_is_event_archive('day')) {
    //Viewing date archive
    echo __('Galas: ', 'eventorganiser') . ' ' . eo_get_event_archive_date('jS F Y');
} elseif (eo_is_event_archive('month')) {
    //Viewing month archive
    echo __('Galas: ', 'eventorganiser') . ' ' . eo_get_event_archive_date('F Y');
} elseif (eo_is_event_archive('year')) {
    //Viewing year archive
    echo __('Galas: ', 'eventorganiser') . ' ' . eo_get_event_archive_date('Y');
} else {
    _e('Galas', 'eventorganiser');
}
?>
                    </h2>

<hr>
                    
					<?php 
eo_get_template_part('eo-loop-events');
//Lists the events
?>
            
/**
 * Parses event queries and alters the WP_Query object appropriately
 *
 * Parse's the query, and sets date range and other event specific query variables.
 * If query is for 'event' post type - the posts_* filters are added.
 *
 * Hooked onto pre_get_posts
 * @since 1.0.0
 * @access private
 * @ignore
 *
 * @param WP_Query $query The query
 */
function eventorganiser_pre_get_posts($query)
{
    //Deprecated, use event-venue instead.
    if (!empty($query->query_vars['venue'])) {
        $venue = $query->get('venue');
        $query->set('event-venue', $venue);
        $query->set('post_type', 'event');
    }
    //If the query is for eo-events feed, set post type
    if ($query->is_feed('eo-events')) {
        $query->set('post_type', 'event');
    }
    //If querying for all events starting on given date, set the date parameters
    if (!empty($query->query_vars['ondate'])) {
        $ondate_start = str_replace('/', '-', $query->query_vars['ondate']);
        $ondate_end = str_replace('/', '-', $query->query_vars['ondate']);
        $parts = count(explode('-', $ondate_start));
        if ($parts == 1 && is_numeric($ondate_start)) {
            //Numeric - interpret as year
            $ondate_start .= '-01-01';
            $ondate_end .= '-12-31';
        } elseif ($parts == 2) {
            // 2012-01 format: interpret as month
            $ondate_start .= '-01';
            try {
                $end = new DateTime($ondate_start);
                $ondate_end = $end->format('Y-m-t');
            } catch (Exception $e) {
                $query->set('ondate', false);
            }
        }
        $query->set('post_type', 'event');
        $query->set('event_start_before', $ondate_end);
        $query->set('event_end_after', $ondate_start);
    }
    //If not on event, stop here.
    if (!eventorganiser_is_event_query($query, true)) {
        return $query;
    }
    //@see https://github.com/stephenharris/Event-Organiser/issues/30
    if ($query->is_main_query()) {
        if (eo_is_event_archive('day') || eo_is_event_archive('month') || eo_is_event_archive('year')) {
            $query->set('showpastevents', true);
        }
    }
    $blog_now = new DateTime(null, eo_get_blog_timezone());
    //Determine whether or not to show past events and each occurrence. //If not set, use options
    if (!is_admin() && !is_single() && !$query->is_feed('eo-events') && !isset($query->query_vars['showpastevents'])) {
        //If showpastevents is not set - use options (except for admin / single pages.
        $query->set('showpastevents', eventorganiser_get_option('showpast'));
    }
    //Deprecated: showrepeats - use group_events_by instead
    if (isset($query->query_vars['showrepeats']) && !isset($query->query_vars['group_events_by'])) {
        if (!$query->query_vars['showrepeats']) {
            $query->set('group_events_by', 'series');
        }
    }
    //Determine how to group events: by series or show each occurrence
    if (!isset($query->query_vars['group_events_by'])) {
        //Group by isn't set - default depends on context:
        if ($query->is_main_query() && (is_admin() || is_single() || $query->is_feed('eo-events'))) {
            //If in admin or single page - we probably don't want to see duplicates of (recurrent) events - unless specified otherwise.
            $query->set('group_events_by', 'series');
        } elseif (eventorganiser_get_option('group_events') == 'series') {
            //In other instances (archives, shortcode listing) if showrepeats option is false display only the next event.
            $query->set('group_events_by', 'series');
        } else {
            $query->set('group_events_by', 'occurrence');
        }
    }
    //Parse user input as date-time objects
    $date_objs = array('event_start_after' => '', 'event_start_before' => '', 'event_end_after' => '', 'event_end_before' => '');
    foreach ($date_objs as $prop => $value) {
        $date = $query->get($prop);
        if (!$date instanceof DateTime) {
            try {
                $date = empty($date) ? false : new DateTime($date, eo_get_blog_timezone());
            } catch (Exception $e) {
                $date = false;
            }
        }
        $date_objs[$prop] = $date;
        $query->set($prop, $date);
    }
    //If eo_interval is set, determine date ranges
    if (!empty($query->query_vars['eo_interval'])) {
        switch ($query->get('eo_interval')) {
            case 'expired':
                $meta_query = (array) $query->get('meta_query');
                $meta_query[] = array('key' => '_eventorganiser_schedule_last_finish', 'value' => $blog_now->format('Y-m-d H:i:s'), 'compare' => '<=');
                $query->set('meta_query', $meta_query);
                break;
            case 'future':
                $meta_query = $query->get('meta_query');
                $meta_query = empty($meta_query) ? array() : $meta_query;
                $meta_query[] = array('key' => '_eventorganiser_schedule_last_start', 'value' => $blog_now->format('Y-m-d H:i:s'), 'compare' => '>=');
                $query->set('meta_query', $meta_query);
                break;
            case 'P1D':
            case 'P1W':
            case 'P1M':
            case 'P6M':
            case 'P1Y':
                //I hate you php5.2
                $intervals = array('P1D' => '+1 day', 'P1W' => '+1 week', 'P1M' => '+1 month', 'P6M' => '+6 month', 'P1Y' => '+1 Year');
                $cutoff = clone $blog_now;
                $cutoff->modify($intervals[$query->query_vars['eo_interval']]);
                if (is_admin() && 'series' == $query->get('group_events_by')) {
                    //On admin we want to show the **first** occurrence of a recurring event which has an occurrence in the interval
                    global $wpdb;
                    $post_ids = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT post_id FROM {$wpdb->eo_events}\n\t\t\t\t\t\tWHERE {$wpdb->eo_events}.StartDate <= %s\n\t\t\t\t\t\tAND {$wpdb->eo_events}.EndDate >= %s", $cutoff->format('Y-m-d'), $blog_now->format('Y-m-d')));
                    if ($post_ids) {
                        $query->set('post__in', wp_list_pluck($post_ids, 'post_id'));
                    }
                } else {
                    if (empty($date_objs['event_start_before']) || $cutoff < $date_objs['event_start_before']) {
                        $date_objs['event_start_before'] = $cutoff;
                    }
                    if (empty($date_objs['event_end_after']) || $blog_now > $date_objs['event_end_after']) {
                        $date_objs['event_end_after'] = $blog_now;
                    }
                }
        }
    }
    //Endif interval set
    $running_event_is_past = eventorganiser_get_option('runningisnotpast') ? true : false;
    //Set date range according to whether we show past events
    if (isset($query->query_vars['showpastevents']) && !$query->query_vars['showpastevents']) {
        //Showing only future events
        //Running event is past - Get events which start in the future
        //A current event is not past - Get events which finish in the future
        $key = $running_event_is_past ? 'event_start_after' : 'event_end_after';
        //If current queried date is not set or before now, set the queried date to now
        $date_objs[$key] = empty($date_objs[$key]) || $blog_now > $date_objs[$key] ? $blog_now : $date_objs[$key];
    }
    //Set event dates to 'Y-m-d H:i:s' format.
    foreach ($date_objs as $prop => $datetime) {
        if (!empty($datetime)) {
            $query->set($prop, $datetime->format('Y-m-d H:i:s'));
        }
    }
    if ($query->is_feed('eo-events')) {
        //Posts per page for feeds bug https://core.trac.wordpress.org/ticket/17853
        add_filter('post_limits', 'wp17853_eventorganiser_workaround');
        $query->set('posts_per_page', -1);
    }
    //Add the posts_* filters to modify the query
    add_filter('posts_fields', 'eventorganiser_event_fields', 10, 2);
    add_filter('posts_join', 'eventorganiser_join_tables', 10, 2);
    add_filter('posts_where', 'eventorganiser_events_where', 10, 2);
    add_filter('posts_orderby', 'eventorganiser_sort_events', 10, 2);
    add_filter('posts_groupby', 'eventorganiser_event_groupby', 10, 2);
}