From f2c2e7c107fa90d767d618d7c34c9f075a97dbe3 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Sun, 26 Jan 2014 17:41:50 +1100 Subject: [PATCH] Link calendar date to event if only one on that day --- admin/templates/events-calendar.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/templates/events-calendar.php b/admin/templates/events-calendar.php index 973876e0..384590b1 100644 --- a/admin/templates/events-calendar.php +++ b/admin/templates/events-calendar.php @@ -106,13 +106,13 @@ if ( !function_exists( 'sportspress_events_calendar' ) ) { '; // Get days with posts - $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date) + $dayswithposts = $wpdb->get_results("SELECT DAYOFMONTH(post_date), ID FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' AND post_type = 'sp_event' AND ( post_status = 'publish' OR post_status = 'future' ) AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N); if ( $dayswithposts ) { foreach ( (array) $dayswithposts as $daywith ) { - $daywithpost[] = $daywith[0]; + $daywithpost[ $daywith[0] ][] = $daywith[1]; } } else { $daywithpost = array(); @@ -161,8 +161,8 @@ if ( !function_exists( 'sportspress_events_calendar' ) ) { else $calendar_output .= ''; - if ( in_array($day, $daywithpost) ) // any posts today? - $calendar_output .= '$day"; + if ( array_key_exists($day, $daywithpost) ) // any posts today? + $calendar_output .= '$day"; else $calendar_output .= $day; $calendar_output .= '';