diff --git a/src/wp-includes/class-walker-category.php b/src/wp-includes/class-walker-category.php
index c881e68..bfea72b 100644
a
|
b
|
class Walker_Category extends Walker { |
111 | 111 | $atts = array(); |
112 | 112 | $atts['href'] = get_term_link( $category ); |
113 | 113 | |
| 114 | // Add aria-curent attribute to the current category. |
| 115 | $_current_terms = get_terms( |
| 116 | $category->taxonomy, |
| 117 | array( |
| 118 | 'include' => $args['current_category'], |
| 119 | 'hide_empty' => false, |
| 120 | ) |
| 121 | ); |
| 122 | $aria_current = ''; |
| 123 | foreach ( $_current_terms as $_current_term ) { |
| 124 | if ( $category->term_id == $_current_term->term_id ) { |
| 125 | $aria_current = ' aria-current="page"'; |
| 126 | } |
| 127 | } |
| 128 | |
114 | 129 | if ( $args['use_desc_for_title'] && ! empty( $category->description ) ) { |
115 | 130 | /** |
116 | 131 | * Filters the category description for display. |
… |
… |
class Walker_Category extends Walker { |
145 | 160 | foreach ( $atts as $attr => $value ) { |
146 | 161 | if ( ! empty( $value ) ) { |
147 | 162 | $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
148 | | $attributes .= ' ' . $attr . '="' . $value . '"'; |
| 163 | $attributes .= ' ' . $attr . '="' . $value . '"' . $aria_current; |
149 | 164 | } |
150 | 165 | } |
151 | 166 | |
diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
index 8e8ab20..65c2272 100644
a
|
b
|
function get_archives_link( $url, $text, $format = 'html', $before = '', $after |
1738 | 1738 | $selected_attr = $selected ? " selected='selected'" : ''; |
1739 | 1739 | $link_html = "\t<option value='$url'$selected_attr>$before $text $after</option>\n"; |
1740 | 1740 | } elseif ( 'html' == $format ) { |
1741 | | $link_html = "\t<li>$before<a href='$url'>$text</a>$after</li>\n"; |
| 1741 | $aria_current = $selected ? " aria-current='page'" : ''; |
| 1742 | $link_html = "\t<li>$before<a href='$url'$aria_current>$text</a>$after</li>\n"; |
1742 | 1743 | } else { // custom |
1743 | | $link_html = "\t$before<a href='$url'>$text</a>$after\n"; |
| 1744 | $aria_current = $selected ? " aria-current='page'" : ''; |
| 1745 | $link_html = "\t$before<a href='$url'$aria_current>$text</a>$after\n"; |
1744 | 1746 | } |
1745 | 1747 | |
1746 | 1748 | /** |
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 c137849..d9403bf 100644
a
|
b
|
class WP_Widget_Recent_Posts extends WP_Widget { |
93 | 93 | <ul> |
94 | 94 | <?php foreach ( $r->posts as $recent_post ) : ?> |
95 | 95 | <?php |
96 | | $post_title = get_the_title( $recent_post->ID ); |
97 | | $title = ( ! empty( $post_title ) ) ? $post_title : __( '(no title)' ); |
| 96 | $post_title = get_the_title( $recent_post->ID ); |
| 97 | $title = ( ! empty( $post_title ) ) ? $post_title : __( '(no title)' ); |
| 98 | $aria_current = ( $recent_post->ID === get_the_ID() ) ? ' aria-current="page"' : ''; |
98 | 99 | ?> |
99 | 100 | <li> |
100 | | <a href="<?php the_permalink( $recent_post->ID ); ?>"><?php echo $title; ?></a> |
| 101 | <a href="<?php the_permalink( $recent_post->ID ); ?>"<?php echo $aria_current; ?>><?php echo $title; ?></a> |
101 | 102 | <?php if ( $show_date ) : ?> |
102 | 103 | <span class="post-date"><?php echo get_the_date( '', $recent_post->ID ); ?></span> |
103 | 104 | <?php endif; ?> |