- 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-archives.php
r47593 r48349 41 41 */ 42 42 public function widget( $args, $instance ) { 43 $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Archives' ); 43 $default_title = __( 'Archives' ); 44 $title = ! empty( $instance['title'] ) ? $instance['title'] : $default_title; 44 45 45 46 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ … … 121 122 /* ]]> */ 122 123 </script> 123 124 <?php } else { ?>125 <ul>126 124 <?php 127 wp_get_archives( 128 /** 129 * Filters the arguments for the Archives widget. 130 * 131 * @since 2.8.0 132 * @since 4.9.0 Added the `$instance` parameter. 133 * 134 * @see wp_get_archives() 135 * 136 * @param array $args An array of Archives option arguments. 137 * @param array $instance Array of settings for the current widget. 138 */ 139 apply_filters( 140 'widget_archives_args', 141 array( 142 'type' => 'monthly', 143 'show_post_count' => $count, 144 ), 145 $instance 146 ) 147 ); 125 } else { 126 $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; 127 128 /** 129 * Filters the HTML format of widgets with navigation links. 130 * 131 * @since 5.5.0 132 * 133 * @param string $format The type of markup to use in widgets with navigation links. 134 * Accepts 'html5', 'xhtml'. 135 */ 136 $format = apply_filters( 'navigation_widgets_format', $format ); 137 138 if ( 'html5' === $format ) { 139 // The title may be filtered: Strip out HTML and make sure the aria-label is never empty. 140 $title = trim( strip_tags( $title ) ); 141 $aria_label = $title ? $title : $default_title; 142 echo '<nav role="navigation" aria-label="' . esc_attr( $aria_label ) . '">'; 143 } 148 144 ?> 149 </ul> 145 146 <ul> 147 <?php 148 wp_get_archives( 149 /** 150 * Filters the arguments for the Archives widget. 151 * 152 * @since 2.8.0 153 * @since 4.9.0 Added the `$instance` parameter. 154 * 155 * @see wp_get_archives() 156 * 157 * @param array $args An array of Archives option arguments. 158 * @param array $instance Array of settings for the current widget. 159 */ 160 apply_filters( 161 'widget_archives_args', 162 array( 163 'type' => 'monthly', 164 'show_post_count' => $count, 165 ), 166 $instance 167 ) 168 ); 169 ?> 170 </ul> 171 <?php if ( 'html5' === $format ) : ?> 172 </nav> 173 <?php endif; ?> 174 150 175 <?php 176 echo $args['after_widget']; 151 177 } 152 153 echo $args['after_widget'];154 178 } 155 179
Note: See TracChangeset
for help on using the changeset viewer.