@@ -1953,20 +1953,21 @@ function my_calendar( $args ) {
1953
1953
$ heading = "< $ hl id='mc_head_ $ id' class='mc-single heading my-calendar- $ params [time]'><span> " . trim ( $ heading_text ) . "</span></ $ hl> " ;
1954
1954
$ dateclass = mc_dateclass ( $ current );
1955
1955
$ mc_events = '' ;
1956
- $ events = my_calendar_events ( $ query );
1956
+ $ dates = my_calendar_events ( $ query );
1957
1957
$ events_class = '' ;
1958
1958
$ json = '' ;
1959
- foreach ( $ events as $ day ) {
1960
- $ events_class = mc_events_class ( $ day , $ from );
1961
- $ params ['groups ' ] = $ shown_groups ;
1962
- $ params ['events ' ] = $ shown_events ;
1963
- $ event_output = my_calendar_draw_events ( $ day , $ params , $ from , $ template , $ id );
1964
- $ shown_groups = array_merge ( $ shown_groups , $ event_output ['groups ' ] );
1965
- $ shown_events = array_merge ( $ shown_events , $ event_output ['events ' ] );
1966
- if ( ! empty ( $ event_output ) ) {
1967
- $ mc_events .= $ event_output ['html ' ];
1968
- $ json = array ( $ event_output ['json ' ] );
1969
- }
1959
+ // The $events array explodes multi-day events to contain each individual day.
1960
+ // Only display the versions relevant to the current day.
1961
+ $ events = $ dates [ $ from ];
1962
+ $ events_class = mc_events_class ( $ events , $ from );
1963
+ $ params ['groups ' ] = $ shown_groups ;
1964
+ $ params ['events ' ] = $ shown_events ;
1965
+ $ event_output = my_calendar_draw_events ( $ events , $ params , $ from , $ template , $ id );
1966
+ $ shown_groups = array_merge ( $ shown_groups , $ event_output ['groups ' ] );
1967
+ $ shown_events = array_merge ( $ shown_events , $ event_output ['events ' ] );
1968
+ if ( ! empty ( $ event_output ) ) {
1969
+ $ mc_events .= $ event_output ['html ' ];
1970
+ $ json = array ( $ event_output ['json ' ] );
1970
1971
}
1971
1972
$ body .= $ heading . $ top . '
1972
1973
<div class="mc-content">
0 commit comments