- Timestamp:
- 07/06/2020 08:42:14 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/widgets/class-wp-widget-recent-comments.php
r48109 r48349 83 83 $output = ''; 84 84 85 $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Comments' ); 85 $default_title = __( 'Recent Comments' ); 86 $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : $default_title; 86 87 87 88 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ … … 124 125 $first_instance = false; 125 126 127 $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; 128 129 /** 130 * Filters the HTML format of widgets with navigation links. 131 * 132 * @since 5.5.0 133 * 134 * @param string $format The type of markup to use in widgets with navigation links. 135 * Accepts 'html5', 'xhtml'. 136 */ 137 $format = apply_filters( 'navigation_widgets_format', $format ); 138 139 if ( 'html5' === $format ) { 140 // The title may be filtered: Strip out HTML and make sure the aria-label is never empty. 141 $title = trim( strip_tags( $title ) ); 142 $aria_label = $title ? $title : $default_title; 143 $output .= '<nav role="navigation" aria-label="' . esc_attr( $aria_label ) . '">'; 144 } 145 126 146 $output .= '<ul id="' . esc_attr( $recent_comments_id ) . '">'; 127 147 if ( is_array( $comments ) && $comments ) { … … 142 162 } 143 163 $output .= '</ul>'; 164 165 if ( 'html5' === $format ) { 166 $output .= '</nav>'; 167 } 168 144 169 $output .= $args['after_widget']; 145 170
Note: See TracChangeset
for help on using the changeset viewer.