Make WordPress Core

Changeset 47374


Ignore:
Timestamp:
02/25/2020 08:28:29 PM (5 years ago)
Author:
SergeyBiryukov
Message:

General: Introduce HTML classes in get_calendar() for easier CSS targeting:

  • .wp-calendar-table for the <table> element.
  • .wp-calendar-nav for the navigation wrapper.
  • .wp-calendar-nav-prev for the previous month link.
  • .wp-calendar-nav-next for the next month link.

Replace #prev and #next HTML IDs with .wp-calendar-nav-prev and .wp-calendar-nav-next classes.

Props sabernhardt, BackuPs, audrasjb, jorbin.
Fixes #39763.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r47305 r47374  
    21442144    /* translators: Calendar caption: 1: Month name, 2: 4-digit year. */
    21452145    $calendar_caption = _x( '%1$s %2$s', 'calendar caption' );
    2146     $calendar_output  = '<table id="wp-calendar">
     2146    $calendar_output  = '<table id="wp-calendar" class="wp-calendar-table">
    21472147    <caption>' . sprintf(
    21482148        $calendar_caption,
     
    22392239    $calendar_output .= "\n\t</table>";
    22402240
    2241     $calendar_output .= '<nav aria-label="' . __( 'Previous and next months' ) . '">';
     2241    $calendar_output .= '<nav aria-label="' . __( 'Previous and next months' ) . '" class="wp-calendar-nav">';
    22422242
    22432243    if ( $previous ) {
    2244         $calendar_output .= "\n\t\t" . '<span id="prev"><a href="' . get_month_link( $previous->year, $previous->month ) . '">&laquo; ' .
     2244        $calendar_output .= "\n\t\t" . '<span class="wp-calendar-nav-prev"><a href="' . get_month_link( $previous->year, $previous->month ) . '">&laquo; ' .
    22452245            $wp_locale->get_month_abbrev( $wp_locale->get_month( $previous->month ) ) .
    22462246        '</a></span>';
    22472247    } else {
    2248         $calendar_output .= "\n\t\t" . '<span id="prev">&nbsp;</span>';
     2248        $calendar_output .= "\n\t\t" . '<span class="wp-calendar-nav-prev">&nbsp;</span>';
    22492249    }
    22502250
     
    22522252
    22532253    if ( $next ) {
    2254         $calendar_output .= "\n\t\t" . '<span id="next"><a href="' . get_month_link( $next->year, $next->month ) . '">' .
     2254        $calendar_output .= "\n\t\t" . '<span class="wp-calendar-nav-next"><a href="' . get_month_link( $next->year, $next->month ) . '">' .
    22552255            $wp_locale->get_month_abbrev( $wp_locale->get_month( $next->month ) ) .
    22562256        ' &raquo;</a></span>';
    22572257    } else {
    2258         $calendar_output .= "\n\t\t" . '<span id="next" class="pad">&nbsp;</span>';
     2258        $calendar_output .= "\n\t\t" . '<span class="wp-calendar-nav-next">&nbsp;</span>';
    22592259    }
    22602260
Note: See TracChangeset for help on using the changeset viewer.