diff --git a/src/wp-includes/widgets/class-wp-nav-menu-widget.php b/src/wp-includes/widgets/class-wp-nav-menu-widget.php
index 1edaeac464..9972e2a2c7 100644
a
|
b
|
class WP_Nav_Menu_Widget extends WP_Widget { |
57 | 57 | echo $args['before_title'] . $title . $args['after_title']; |
58 | 58 | } |
59 | 59 | |
60 | | $nav_menu_args = array( |
61 | | 'fallback_cb' => '', |
62 | | 'menu' => $nav_menu, |
63 | | ); |
| 60 | $format = current_theme_supports( 'html5', 'navigation' ) ? 'html5' : 'xhtml'; |
| 61 | |
| 62 | /** |
| 63 | * Filters the HTML format of widgets with navigation links. |
| 64 | * |
| 65 | * @since 5.5.0 |
| 66 | * |
| 67 | * @param string $format The type of markup to use in widgets with navigation links. |
| 68 | * Accepts 'html5', 'xhtml'. |
| 69 | */ |
| 70 | $format = apply_filters( 'navigation_widgets_format', $format ); |
| 71 | |
| 72 | if ( 'html5' === $format ) { |
| 73 | $nav_menu_args = array( |
| 74 | 'fallback_cb' => '', |
| 75 | 'menu' => $nav_menu, |
| 76 | 'items_wrap' => '<nav role="navigation"><ul id="%1$s" class="%2$s">%3$s</ul></nav>', |
| 77 | ); |
| 78 | } else { |
| 79 | $nav_menu_args = array( |
| 80 | 'fallback_cb' => '', |
| 81 | 'menu' => $nav_menu, |
| 82 | ); |
| 83 | } |
64 | 84 | |
65 | 85 | /** |
66 | 86 | * Filters the arguments for the Navigation Menu widget. |
diff --git a/src/wp-includes/widgets/class-wp-widget-archives.php b/src/wp-includes/widgets/class-wp-widget-archives.php
index 2dfd60c7a5..fa2911564b 100644
a
|
b
|
class WP_Widget_Archives extends WP_Widget { |
121 | 121 | /* ]]> */ |
122 | 122 | </script> |
123 | 123 | |
124 | | <?php } else { ?> |
125 | | <ul> |
126 | | <?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 | | ); |
| 124 | <?php } else { |
| 125 | $format = current_theme_supports( 'html5', 'navigation' ) ? 'html5' : 'xhtml'; |
| 126 | |
| 127 | /** |
| 128 | * Filters the HTML format of widgets with navigation links. |
| 129 | * |
| 130 | * @since 5.5.0 |
| 131 | * |
| 132 | * @param string $format The type of markup to use in widgets with navigation links. |
| 133 | * Accepts 'html5', 'xhtml'. |
| 134 | */ |
| 135 | $format = apply_filters( 'navigation_widgets_format', $format ); |
148 | 136 | ?> |
149 | | </ul> |
150 | | <?php |
151 | | } |
152 | 137 | |
| 138 | <?php if ( 'html5' === $format ) : ?> |
| 139 | <nav role="navigation"> |
| 140 | <?php endif; ?> |
| 141 | |
| 142 | <ul> |
| 143 | <?php |
| 144 | wp_get_archives( |
| 145 | /** |
| 146 | * Filters the arguments for the Archives widget. |
| 147 | * |
| 148 | * @since 2.8.0 |
| 149 | * @since 4.9.0 Added the `$instance` parameter. |
| 150 | * |
| 151 | * @see wp_get_archives() |
| 152 | * |
| 153 | * @param array $args An array of Archives option arguments. |
| 154 | * @param array $instance Array of settings for the current widget. |
| 155 | */ |
| 156 | apply_filters( |
| 157 | 'widget_archives_args', |
| 158 | array( |
| 159 | 'type' => 'monthly', |
| 160 | 'show_post_count' => $count, |
| 161 | ), |
| 162 | $instance |
| 163 | ) |
| 164 | ); |
| 165 | ?> |
| 166 | </ul> |
| 167 | <?php if ( 'html5' === $format ) : ?> |
| 168 | </nav> |
| 169 | <?php endif; ?> |
| 170 | |
| 171 | <?php |
153 | 172 | echo $args['after_widget']; |
154 | 173 | } |
155 | 174 | |
diff --git a/src/wp-includes/widgets/class-wp-widget-categories.php b/src/wp-includes/widgets/class-wp-widget-categories.php
index 0d53139cc9..236086cf56 100644
a
|
b
|
class WP_Widget_Categories extends WP_Widget { |
109 | 109 | |
110 | 110 | <?php |
111 | 111 | } else { |
112 | | ?> |
113 | | <ul> |
114 | | <?php |
115 | | $cat_args['title_li'] = ''; |
| 112 | $format = current_theme_supports( 'html5', 'navigation' ) ? 'html5' : 'xhtml'; |
116 | 113 | |
117 | 114 | /** |
118 | | * Filters the arguments for the Categories widget. |
| 115 | * Filters the HTML format of widgets with navigation links. |
119 | 116 | * |
120 | | * @since 2.8.0 |
121 | | * @since 4.9.0 Added the `$instance` parameter. |
| 117 | * @since 5.5.0 |
122 | 118 | * |
123 | | * @param array $cat_args An array of Categories widget options. |
124 | | * @param array $instance Array of settings for the current widget. |
| 119 | * @param string $format The type of markup to use in widgets with navigation links. |
| 120 | * Accepts 'html5', 'xhtml'. |
125 | 121 | */ |
126 | | wp_list_categories( apply_filters( 'widget_categories_args', $cat_args, $instance ) ); |
| 122 | $format = apply_filters( 'navigation_widgets_format', $format ); |
127 | 123 | ?> |
128 | | </ul> |
| 124 | |
| 125 | <?php if ( 'html5' === $format ) : ?> |
| 126 | <nav role="navigation"> |
| 127 | <?php endif; ?> |
| 128 | |
| 129 | <ul> |
| 130 | <?php |
| 131 | $cat_args['title_li'] = ''; |
| 132 | |
| 133 | /** |
| 134 | * Filters the arguments for the Categories widget. |
| 135 | * |
| 136 | * @since 2.8.0 |
| 137 | * @since 4.9.0 Added the `$instance` parameter. |
| 138 | * |
| 139 | * @param array $cat_args An array of Categories widget options. |
| 140 | * @param array $instance Array of settings for the current widget. |
| 141 | */ |
| 142 | wp_list_categories( apply_filters( 'widget_categories_args', $cat_args, $instance ) ); |
| 143 | ?> |
| 144 | </ul> |
| 145 | |
| 146 | <?php if ( 'html5' === $format ) : ?> |
| 147 | </nav> |
| 148 | <?php endif; ?> |
| 149 | |
129 | 150 | <?php |
130 | 151 | } |
131 | 152 | |
diff --git a/src/wp-includes/widgets/class-wp-widget-meta.php b/src/wp-includes/widgets/class-wp-widget-meta.php
index 33742b368d..e838d2828c 100644
a
|
b
|
class WP_Widget_Meta extends WP_Widget { |
52 | 52 | if ( $title ) { |
53 | 53 | echo $args['before_title'] . $title . $args['after_title']; |
54 | 54 | } |
55 | | ?> |
56 | | <ul> |
| 55 | |
| 56 | $format = current_theme_supports( 'html5', 'navigation' ) ? 'html5' : 'xhtml'; |
| 57 | |
| 58 | /** |
| 59 | * Filters the HTML format of widgets with navigation links. |
| 60 | * |
| 61 | * @since 5.5.0 |
| 62 | * |
| 63 | * @param string $format The type of markup to use in widgets with navigation links. |
| 64 | * Accepts 'html5', 'xhtml'. |
| 65 | */ |
| 66 | $format = apply_filters( 'navigation_widgets_format', $format ); |
| 67 | |
| 68 | <?php if ( 'html5' === $format ) : ?> |
| 69 | <nav role="navigation"> |
| 70 | <?php endif; ?> |
| 71 | |
| 72 | <ul> |
57 | 73 | <?php wp_register(); ?> |
58 | 74 | <li><?php wp_loginout(); ?></li> |
59 | 75 | <li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php _e( 'Entries feed' ); ?></a></li> |
60 | 76 | <li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php _e( 'Comments feed' ); ?></a></li> |
| 77 | |
61 | 78 | <?php |
62 | 79 | /** |
63 | 80 | * Filters the "WordPress.org" list item HTML in the Meta widget. |
… |
… |
class WP_Widget_Meta extends WP_Widget { |
80 | 97 | |
81 | 98 | wp_meta(); |
82 | 99 | ?> |
83 | | </ul> |
84 | | <?php |
85 | 100 | |
86 | | echo $args['after_widget']; |
| 101 | </ul> |
| 102 | |
| 103 | <?php if ( 'html5' === $format ) : ?> |
| 104 | </nav> |
| 105 | <?php endif; ?> |
| 106 | |
| 107 | <?php |
| 108 | echo $args['after_widget']; |
87 | 109 | } |
88 | 110 | |
89 | 111 | /** |
diff --git a/src/wp-includes/widgets/class-wp-widget-pages.php b/src/wp-includes/widgets/class-wp-widget-pages.php
index 94af11d658..fa0daeffe2 100644
a
|
b
|
class WP_Widget_Pages extends WP_Widget { |
89 | 89 | if ( $title ) { |
90 | 90 | echo $args['before_title'] . $title . $args['after_title']; |
91 | 91 | } |
| 92 | |
| 93 | $format = current_theme_supports( 'html5', 'navigation' ) ? 'html5' : 'xhtml'; |
| 94 | |
| 95 | /** |
| 96 | * Filters the HTML format of widgets with navigation links. |
| 97 | * |
| 98 | * @since 5.5.0 |
| 99 | * |
| 100 | * @param string $format The type of markup to use in widgets with navigation links. |
| 101 | * Accepts 'html5', 'xhtml'. |
| 102 | */ |
| 103 | $format = apply_filters( 'navigation_widgets_format', $format ); |
92 | 104 | ?> |
93 | | <ul> |
94 | | <?php echo $out; ?> |
95 | | </ul> |
| 105 | |
| 106 | <?php if ( 'html5' === $format ) : ?> |
| 107 | <nav role="navigation"> |
| 108 | <?php endif; ?> |
| 109 | |
| 110 | <ul> |
| 111 | <?php echo $out; ?> |
| 112 | </ul> |
| 113 | |
| 114 | <?php if ( 'html5' === $format ) : ?> |
| 115 | </nav> |
| 116 | <?php endif; ?> |
| 117 | |
96 | 118 | <?php |
97 | 119 | echo $args['after_widget']; |
98 | 120 | } |
diff --git a/src/wp-includes/widgets/class-wp-widget-recent-comments.php b/src/wp-includes/widgets/class-wp-widget-recent-comments.php
index fd8ae05fdc..b53494a6f8 100644
a
|
b
|
class WP_Widget_Recent_Comments extends WP_Widget { |
123 | 123 | $recent_comments_id = ( $first_instance ) ? 'recentcomments' : "recentcomments-{$this->number}"; |
124 | 124 | $first_instance = false; |
125 | 125 | |
| 126 | $format = current_theme_supports( 'html5', 'navigation' ) ? '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 | $output .= '<nav role="navigation">'; |
| 140 | } |
| 141 | |
126 | 142 | $output .= '<ul id="' . esc_attr( $recent_comments_id ) . '">'; |
127 | 143 | if ( is_array( $comments ) && $comments ) { |
128 | 144 | // Prime cache for associated posts. (Prime post term cache if we need it for permalinks.) |
… |
… |
class WP_Widget_Recent_Comments extends WP_Widget { |
141 | 157 | } |
142 | 158 | } |
143 | 159 | $output .= '</ul>'; |
| 160 | |
| 161 | if ( 'html5' === $format ) { |
| 162 | $output .= '</nav>'; |
| 163 | } |
| 164 | |
144 | 165 | $output .= $args['after_widget']; |
145 | 166 | |
146 | 167 | echo $output; |
diff --git a/src/wp-includes/widgets/class-wp-widget-recent-posts.php b/src/wp-includes/widgets/class-wp-widget-recent-posts.php
index 9767e3b4fc..672115c1ee 100644
a
|
b
|
class WP_Widget_Recent_Posts extends WP_Widget { |
84 | 84 | return; |
85 | 85 | } |
86 | 86 | ?> |
| 87 | |
87 | 88 | <?php echo $args['before_widget']; ?> |
| 89 | |
88 | 90 | <?php |
89 | 91 | if ( $title ) { |
90 | 92 | echo $args['before_title'] . $title . $args['after_title']; |
91 | 93 | } |
| 94 | |
| 95 | $format = current_theme_supports( 'html5', 'navigation' ) ? 'html5' : 'xhtml'; |
| 96 | |
| 97 | /** |
| 98 | * Filters the HTML format of widgets with navigation links. |
| 99 | * |
| 100 | * @since 5.5.0 |
| 101 | * |
| 102 | * @param string $format The type of markup to use in widgets with navigation links. |
| 103 | * Accepts 'html5', 'xhtml'. |
| 104 | */ |
| 105 | $format = apply_filters( 'navigation_widgets_format', $format ); |
92 | 106 | ?> |
| 107 | |
| 108 | <?php if ( 'html5' === $format ) : ?> |
| 109 | <nav role="navigation"> |
| 110 | <?php endif; ?> |
| 111 | |
93 | 112 | <ul> |
94 | 113 | <?php foreach ( $r->posts as $recent_post ) : ?> |
95 | 114 | <?php |
… |
… |
class WP_Widget_Recent_Posts extends WP_Widget { |
109 | 128 | </li> |
110 | 129 | <?php endforeach; ?> |
111 | 130 | </ul> |
| 131 | <?php if ( 'html5' === $format ) : ?> |
| 132 | </nav> |
| 133 | <?php endif; ?> |
| 134 | |
112 | 135 | <?php |
113 | 136 | echo $args['after_widget']; |
114 | 137 | } |
diff --git a/src/wp-includes/widgets/class-wp-widget-rss.php b/src/wp-includes/widgets/class-wp-widget-rss.php
index 385bccfd7e..591b88f555 100644
a
|
b
|
class WP_Widget_RSS extends WP_Widget { |
94 | 94 | if ( $title ) { |
95 | 95 | echo $args['before_title'] . $title . $args['after_title']; |
96 | 96 | } |
| 97 | |
| 98 | $format = current_theme_supports( 'html5', 'navigation' ) ? 'html5' : 'xhtml'; |
| 99 | |
| 100 | /** |
| 101 | * Filters the HTML format of widgets with navigation links. |
| 102 | * |
| 103 | * @since 5.5.0 |
| 104 | * |
| 105 | * @param string $format The type of markup to use in widgets with navigation links. |
| 106 | * Accepts 'html5', 'xhtml'. |
| 107 | */ |
| 108 | $format = apply_filters( 'navigation_widgets_format', $format ); |
| 109 | |
| 110 | if ( 'html5' === $format ) { |
| 111 | echo '<nav role="navigation">'; |
| 112 | } |
| 113 | |
97 | 114 | wp_widget_rss_output( $rss, $instance ); |
| 115 | |
| 116 | if ( 'html5' === $format ) { |
| 117 | echo '</nav>'; |
| 118 | } |
| 119 | |
98 | 120 | echo $args['after_widget']; |
99 | 121 | |
100 | 122 | if ( ! is_wp_error( $rss ) ) { |