WordPress.org

Make WordPress Core

Ticket #26553: 26553.2.patch

File 26553.2.patch, 1.7 KB (added by joedolson, 6 years ago)

Update patch with screen reader text

  • wp-includes/comment-template.php

     
    12741274        global $wpcommentspopupfile, $wpcommentsjavascript;
    12751275
    12761276        $id = get_the_ID();
    1277 
    1278         if ( false === $zero ) $zero = __( 'No Comments' );
    1279         if ( false === $one ) $one = __( '1 Comment' );
    1280         if ( false === $more ) $more = __( '% Comments' );
    1281         if ( false === $none ) $none = __( 'Comments Off' );
    1282 
     1277        $span = '<span class="screen-reader-text">';
     1278        $title = get_the_title();
     1279        $span_close = '</span>';
     1280       
    12831281        $number = get_comments_number( $id );
     1282       
     1283        if ( false === $zero ) $zero = sprintf( __( 'No Comments%1$s on %2$s%3$s' ), $span, $title, $span_close );
     1284        if ( false === $one ) $one = sprintf( __( '1 Comment%1$s on %2$s%3$s' ), $span, $title, $span_close );
     1285        if ( false === $more ) $more = sprintf( __( '%4$d Comments%1$s on %2$s%3$s' ), $span, $title, $span_close, $number );
     1286        if ( false === $none ) $none = sprintf( __( 'Comments Off%1$s on %2$s%3$s' ), $span, $title, $span_close );
    12841287
    12851288        if ( 0 == $number && !comments_open() && !pings_open() ) {
    12861289                echo '<span' . ((!empty($css_class)) ? ' class="' . esc_attr( $css_class ) . '"' : '') . '>' . $none . '</span>';
     
    13111314        if ( !empty( $css_class ) ) {
    13121315                echo ' class="'.$css_class.'" ';
    13131316        }
    1314         $title = the_title_attribute( array('echo' => 0 ) );
    13151317
    13161318        $attributes = '';
    13171319        /**
     
    13231325         */
    13241326        echo apply_filters( 'comments_popup_link_attributes', $attributes );
    13251327
    1326         echo ' title="' . esc_attr( sprintf( __('Comment on %s'), $title ) ) . '">';
     1328        echo '>';
    13271329        comments_number( $zero, $one, $more );
    13281330        echo '</a>';
    13291331}