Make WordPress Core

Ticket #39763: 39763.2.diff

File 39763.2.diff, 2.5 KB (added by isabel_brison, 2 years ago)

Proposed change after a11y feedback from Nov 2019

  • src/wp-includes/general-template.php

    diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
    index 85aacb44ff..c9db4b755e 100644
    a b function get_calendar( $initial = true, $echo = true ) { 
    21662166
    21672167        $calendar_output .= '
    21682168        </tr>
    2169         </thead>
    2170 
    2171         <tfoot>
    2172         <tr>';
    2173 
    2174         if ( $previous ) {
    2175                 $calendar_output .= "\n\t\t" . '<td colspan="3" id="prev"><a href="' . get_month_link( $previous->year, $previous->month ) . '">&laquo; ' .
    2176                         $wp_locale->get_month_abbrev( $wp_locale->get_month( $previous->month ) ) .
    2177                 '</a></td>';
    2178         } else {
    2179                 $calendar_output .= "\n\t\t" . '<td colspan="3" id="prev" class="pad">&nbsp;</td>';
    2180         }
    2181 
    2182         $calendar_output .= "\n\t\t" . '<td class="pad">&nbsp;</td>';
    2183 
    2184         if ( $next ) {
    2185                 $calendar_output .= "\n\t\t" . '<td colspan="3" id="next"><a href="' . get_month_link( $next->year, $next->month ) . '">' .
    2186                         $wp_locale->get_month_abbrev( $wp_locale->get_month( $next->month ) ) .
    2187                 ' &raquo;</a></td>';
    2188         } else {
    2189                 $calendar_output .= "\n\t\t" . '<td colspan="3" id="next" class="pad">&nbsp;</td>';
    2190         }
     2169        </thead>';
    21912170
    21922171        $calendar_output .= '
    2193         </tr>
    2194         </tfoot>
    2195 
    21962172        <tbody>
    21972173        <tr>';
    21982174
    function get_calendar( $initial = true, $echo = true ) { 
    22602236        if ( $pad != 0 && $pad != 7 ) {
    22612237                $calendar_output .= "\n\t\t" . '<td class="pad" colspan="' . esc_attr( $pad ) . '">&nbsp;</td>';
    22622238        }
    2263         $calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>";
     2239        $calendar_output .= "\n\t</tr>\n\t</tbody>";
     2240
     2241        $calendar_output .= "\n\t</table>";
     2242       
     2243        $calendar_output .= '
     2244        <nav aria-label="Previous and next months">';
     2245
     2246        if ( $previous ) {
     2247                $calendar_output .= "\n\t\t" . '<span id="prev"><a href="' . get_month_link( $previous->year, $previous->month ) . '">&laquo; ' .
     2248                        $wp_locale->get_month_abbrev( $wp_locale->get_month( $previous->month ) ) .
     2249                '</a></span>';
     2250        } else {
     2251                $calendar_output .= "\n\t\t" . '<span id="prev">&nbsp;</span>';
     2252        }
     2253
     2254        $calendar_output .= "\n\t\t" . '<span class="pad">&nbsp;</span>';
     2255
     2256        if ( $next ) {
     2257                $calendar_output .= "\n\t\t" . '<span id="next"><a href="' . get_month_link( $next->year, $next->month ) . '">' .
     2258                        $wp_locale->get_month_abbrev( $wp_locale->get_month( $next->month ) ) .
     2259                ' &raquo;</a></span>';
     2260        } else {
     2261                $calendar_output .= "\n\t\t" . '<span id="next" class="pad">&nbsp;</span>';
     2262        }
     2263
     2264        $calendar_output .= '
     2265        </nav>';
     2266
     2267       
    22642268
    22652269        $cache[ $key ] = $calendar_output;
    22662270        wp_cache_set( 'get_calendar', $cache, 'calendar' );