From bfd32a079f02043c8c68eab9d2d154f3b0e5a12d Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Mon, 13 Nov 2017 23:11:17 +1100 Subject: [PATCH] Add schema microdata to event calendar --- templates/event-calendar.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/templates/event-calendar.php b/templates/event-calendar.php index 2a764652..f07b7c22 100644 --- a/templates/event-calendar.php +++ b/templates/event-calendar.php @@ -222,13 +222,19 @@ for ( $day = 1; $day <= $daysinmonth; ++$day ) { $calendar_output .= "\n\t\n\t\n\t\t"; $newrow = false; - if ( $day == gmdate('j', current_time('timestamp')) && $thismonth == gmdate('m', current_time('timestamp')) && $thisyear == gmdate('Y', current_time('timestamp')) ) - $calendar_output .= ''; - else - $calendar_output .= ''; + $day_has_posts = array_key_exists($day, $daywithpost); + $td_properties = ''; - if ( array_key_exists($day, $daywithpost) ) // any posts today? - $calendar_output .= '$day"; + if ( $day == gmdate('j', current_time('timestamp')) && $thismonth == gmdate('m', current_time('timestamp')) && $thisyear == gmdate('Y', current_time('timestamp')) ) + $td_properties .= ' id="today" class="sp-highlight"'; + + if ( $day_has_posts ) + $td_properties .= ' itemscope itemtype="http://schema.org/SportsEvent"'; + + $calendar_output .= ''; + + if ( $day_has_posts ) // any posts today? + $calendar_output .= '$day"; else $calendar_output .= $day; $calendar_output .= '';