- 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-categories.php
r48111 r48349 45 45 static $first_dropdown = true; 46 46 47 $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Categories' ); 47 $default_title = __( 'Categories' ); 48 $title = ! empty( $instance['title'] ) ? $instance['title'] : $default_title; 48 49 49 50 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ … … 110 111 <?php 111 112 } else { 113 $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; 114 115 /** 116 * Filters the HTML format of widgets with navigation links. 117 * 118 * @since 5.5.0 119 * 120 * @param string $format The type of markup to use in widgets with navigation links. 121 * Accepts 'html5', 'xhtml'. 122 */ 123 $format = apply_filters( 'navigation_widgets_format', $format ); 124 125 if ( 'html5' === $format ) { 126 // The title may be filtered: Strip out HTML and make sure the aria-label is never empty. 127 $title = trim( strip_tags( $title ) ); 128 $aria_label = $title ? $title : $default_title; 129 echo '<nav role="navigation" aria-label="' . esc_attr( $aria_label ) . '">'; 130 } 112 131 ?> 113 <ul> 114 <?php 115 $cat_args['title_li'] = ''; 116 117 /** 118 * Filters the arguments for the Categories widget. 119 * 120 * @since 2.8.0 121 * @since 4.9.0 Added the `$instance` parameter. 122 * 123 * @param array $cat_args An array of Categories widget options. 124 * @param array $instance Array of settings for the current widget. 125 */ 126 wp_list_categories( apply_filters( 'widget_categories_args', $cat_args, $instance ) ); 127 ?> 128 </ul> 132 133 <ul> 134 <?php 135 $cat_args['title_li'] = ''; 136 137 /** 138 * Filters the arguments for the Categories widget. 139 * 140 * @since 2.8.0 141 * @since 4.9.0 Added the `$instance` parameter. 142 * 143 * @param array $cat_args An array of Categories widget options. 144 * @param array $instance Array of settings for the current widget. 145 */ 146 wp_list_categories( apply_filters( 'widget_categories_args', $cat_args, $instance ) ); 147 ?> 148 </ul> 149 150 <?php if ( 'html5' === $format ) : ?> 151 </nav> 152 <?php endif; ?> 153 129 154 <?php 130 155 }
Note: See TracChangeset
for help on using the changeset viewer.