Валидатор ругается на строку в коде календаря не могу понять где именно косяк
буду очень признателен за помощь
Собственно сам код на который ругается
<div id="calendar-4" class="widget widget-footer widget_calendar"><div id="calendar_wrap" class="calendar_wrap"><table id="wp-calendar">
<caption>Октябрь 2018</caption>
<thead>
<tr>
<th scope="col" title="Понедельник">Пн</th>
<th scope="col" title="Вторник">Вт</th>
<th scope="col" title="Среда">Ср</th>
<th scope="col" title="Четверг">Чт</th>
<th scope="col" title="Пятница">Пт</th>
<th scope="col" title="Суббота">Сб</th>
<th scope="col" title="Воскресенье">Вс</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="3" id="prev"><a href="***">« Авг</a></td>
<td class="pad"> </td>
<td colspan="3" id="next" class="pad"> </td>
</tr>
</tfoot>
<tbody>
<tr><td><a href="****" aria-label="Записи, опубликованные 01.10.2018">1</a></td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td>
</tr>
<tr>
<td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td>
</tr>
<tr>
<td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td>
</tr>
<tr>
<td>22</td><td>23</td><td>24</td><td>25</td><td id="today">26</td><td>27</td><td>28</td>
</tr>
<tr>
<td>29</td><td>30</td><td>31</td>
<td class="pad" colspan="4"> </td>
</tr>
</tbody>
</table></div></div>
PHP
$calendar_caption = _x('%1$s %2$s', 'calendar caption');
$calendar_output = '<table id="wp-calendar">
<caption>' . sprintf(
$calendar_caption,
$wp_locale->get_month( $thismonth ),
date( 'Y', $unixmonth )
) . '</caption>
<thead>
<tr>';
$myweek = array();
for ( $wdcount = 0; $wdcount <= 6; $wdcount++ ) {
$myweek[] = $wp_locale->get_weekday( ( $wdcount + $week_begins ) % 7 );
}
foreach ( $myweek as $wd ) {
$day_name = $initial ? $wp_locale->get_weekday_initial( $wd ) : $wp_locale->get_weekday_abbrev( $wd );
$wd = esc_attr( $wd );
$calendar_output .= "\n\t\t<th scope=\"col\" title=\"$wd\">$day_name</th>";
}
$calendar_output .= '
</tr>
</thead>
<tfoot>
<tr>';
if ( $previous ) {
$calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="' . get_month_link( $previous->year, $previous->month ) . '">« ' .
$wp_locale->get_month_abbrev( $wp_locale->get_month( $previous->month ) ) .
'</a></td>';
} else {
$calendar_output .= "\n\t\t".'<td colspan="3" id="prev" class="pad"> </td>';
}
$calendar_output .= "\n\t\t".'<td class="pad"> </td>';
if ( $next ) {
$calendar_output .= "\n\t\t".'<td colspan="3" id="next"><a href="' . get_month_link( $next->year, $next->month ) . '">' .
$wp_locale->get_month_abbrev( $wp_locale->get_month( $next->month ) ) .
' »</a></td>';
} else {
$calendar_output .= "\n\t\t".'<td colspan="3" id="next" class="pad"> </td>';
}
$calendar_output .= '
</tr>
</tfoot>
<tbody>
<tr>';
$daywithpost = array();
$dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date)
FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00'
AND post_type = 'post' AND post_status = 'publish'
AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N);
if ( $dayswithposts ) {
foreach ( (array) $dayswithposts as $daywith ) {
$daywithpost[] = $daywith[0];
}
}
$pad = calendar_week_mod( date( 'w', $unixmonth ) - $week_begins );
if ( 0 != $pad ) {
$calendar_output .= "\n\t\t".'<td colspan="'. esc_attr( $pad ) .'" class="pad"> </td>';
}
$newrow = false;
$daysinmonth = (int) date( 't', $unixmonth );
for ( $day = 1; $day <= $daysinmonth; ++$day ) {
if ( isset($newrow) && $newrow ) {
$calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t";
}
$newrow = false;
if ( $day == gmdate( 'j', $ts ) &&
$thismonth == gmdate( 'm', $ts ) &&
$thisyear == gmdate( 'Y', $ts ) ) {
$calendar_output .= '<td id="today">';
} else {
$calendar_output .= '<td>';
}
if ( in_array( $day, $daywithpost ) ) {
$date_format = date( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) );
/* translators: Post calendar label. 1: Date */
$label = sprintf( __( 'Posts published on %s' ), $date_format );
$calendar_output .= sprintf(
'<a href="%s" aria-label="%s">%s</a>',
get_day_link( $thisyear, $thismonth, $day ),
esc_attr( $label ),
$day
);
} else {
$calendar_output .= $day;
}
$calendar_output .= '</td>';
if ( 6 == calendar_week_mod( date( 'w', mktime(0, 0 , 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) {
$newrow = true;
}
}
$pad = 7 - calendar_week_mod( date( 'w', mktime( 0, 0 , 0, $thismonth, $day, $thisyear ) ) - $week_begins );
if ( $pad != 0 && $pad != 7 ) {
$calendar_output .= "\n\t\t".'<td class="pad" colspan="'. esc_attr( $pad ) .'"> </td>';
}
$calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>";
$cache[ $key ] = $calendar_output;
wp_cache_set( 'get_calendar', $cache, 'calendar' );
if ( $echo ) {
/**
* Filters the HTML calendar output.
*
* @since 3.0.0
*
* @param string $calendar_output HTML output of the calendar.
*/
echo apply_filters( 'get_calendar', $calendar_output );
return;
}
/** This filter is documented in wp-includes/general-template.php */
return apply_filters( 'get_calendar', $calendar_output );
}