Changeset 41371
- Timestamp:
- 09/11/2017 02:28:59 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/general-template.php
r41232 r41371 3262 3262 * 3263 3263 * @since 2.1.0 3264 * @since 4.9.0 Added the `aria_current` argument. 3264 3265 * 3265 3266 * @global WP_Query $wp_query … … 3274 3275 * `max_num_pages` or 1. 3275 3276 * @type int $current The current page number. Default is 'paged' query var or 1. 3277 * @type string $aria_current The value for the aria-current attribute. Possible values are 'page', 3278 * 'step', 'location', 'date', 'time', 'true', 'false'. Default is 'page'. 3276 3279 * @type bool $show_all Whether to show all pages. Default false. 3277 3280 * @type int $end_size How many numbers on either the start and the end list edges. … … 3309 3312 3310 3313 $defaults = array( 3311 'base' => $pagenum_link, // http://example.com/all_posts.php%_% : %_% is replaced by format (below) 3312 'format' => $format, // ?page=%#% : %#% is replaced by the page number 3313 'total' => $total, 3314 'current' => $current, 3315 'show_all' => false, 3316 'prev_next' => true, 3317 'prev_text' => __('« Previous'), 3318 'next_text' => __('Next »'), 3319 'end_size' => 1, 3320 'mid_size' => 2, 3321 'type' => 'plain', 3322 'add_args' => array(), // array of query args to add 3323 'add_fragment' => '', 3314 'base' => $pagenum_link, // http://example.com/all_posts.php%_% : %_% is replaced by format (below) 3315 'format' => $format, // ?page=%#% : %#% is replaced by the page number 3316 'total' => $total, 3317 'current' => $current, 3318 'aria_current' => 'page', 3319 'show_all' => false, 3320 'prev_next' => true, 3321 'prev_text' => __( '« Previous' ), 3322 'next_text' => __( 'Next »' ), 3323 'end_size' => 1, 3324 'mid_size' => 2, 3325 'type' => 'plain', 3326 'add_args' => array(), // array of query args to add 3327 'add_fragment' => '', 3324 3328 'before_page_number' => '', 3325 'after_page_number' => ''3329 'after_page_number' => '', 3326 3330 ); 3327 3331 … … 3387 3391 for ( $n = 1; $n <= $total; $n++ ) : 3388 3392 if ( $n == $current ) : 3389 $page_links[] = "<span class='page-numbers current'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</span>";3393 $page_links[] = "<span aria-current='" . esc_attr( $args['aria_current'] ) . "' class='page-numbers current'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</span>"; 3390 3394 $dots = true; 3391 3395 else : -
trunk/tests/phpunit/tests/general/paginateLinks.php
r34802 r41371 17 17 18 18 $expected =<<<EXPECTED 19 <span class='page-numbers current'>1</span>19 <span aria-current='page' class='page-numbers current'>1</span> 20 20 <a class='page-numbers' href='$page2'>2</a> 21 21 <a class='page-numbers' href='$page3'>3</a> … … 35 35 36 36 $expected =<<<EXPECTED 37 <span class='page-numbers current'>1</span>37 <span aria-current='page' class='page-numbers current'>1</span> 38 38 <a class='page-numbers' href='$page2'>2</a> 39 39 <a class='page-numbers' href='$page3'>3</a> … … 55 55 $expected =<<<EXPECTED 56 56 <a class='page-numbers' href='$home'>1</a> 57 <span class='page-numbers current'>2</span>57 <span aria-current='page' class='page-numbers current'>2</span> 58 58 <a class='page-numbers' href='$page3'>3</a> 59 59 <a class='page-numbers' href='$page4'>4</a> … … 75 75 <a class="prev page-numbers" href="$home">« Previous</a> 76 76 <a class='page-numbers' href='$home'>1</a> 77 <span class='page-numbers current'>2</span>77 <span aria-current='page' class='page-numbers current'>2</span> 78 78 <a class='page-numbers' href='$page3'>3</a> 79 79 <a class='page-numbers' href='$page4'>4</a> … … 300 300 ) ); 301 301 302 $this->assertContains( "<span class='page-numbers current'>3</span>", $links );302 $this->assertContains( "<span aria-current='page' class='page-numbers current'>3</span>", $links ); 303 303 } 304 304
Note: See TracChangeset
for help on using the changeset viewer.