- Timestamp:
- 07/06/2020 08:42:14 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/widgets/class-wp-widget-recent-posts.php
r47593 r48349 46 46 } 47 47 48 $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' ); 48 $default_title = __( 'Recent Posts' ); 49 $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : $default_title; 49 50 50 51 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ … … 85 86 } 86 87 ?> 88 87 89 <?php echo $args['before_widget']; ?> 90 88 91 <?php 89 92 if ( $title ) { 90 93 echo $args['before_title'] . $title . $args['after_title']; 91 94 } 95 96 $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; 97 98 /** 99 * Filters the HTML format of widgets with navigation links. 100 * 101 * @since 5.5.0 102 * 103 * @param string $format The type of markup to use in widgets with navigation links. 104 * Accepts 'html5', 'xhtml'. 105 */ 106 $format = apply_filters( 'navigation_widgets_format', $format ); 107 108 if ( 'html5' === $format ) { 109 // The title may be filtered: Strip out HTML and make sure the aria-label is never empty. 110 $title = trim( strip_tags( $title ) ); 111 $aria_label = $title ? $title : $default_title; 112 echo '<nav role="navigation" aria-label="' . esc_attr( $aria_label ) . '">'; 113 } 92 114 ?> 115 93 116 <ul> 94 117 <?php foreach ( $r->posts as $recent_post ) : ?> … … 110 133 <?php endforeach; ?> 111 134 </ul> 135 <?php if ( 'html5' === $format ) : ?> 136 </nav> 137 <?php endif; ?> 138 112 139 <?php 113 140 echo $args['after_widget'];
Note: See TracChangeset
for help on using the changeset viewer.