diff --git src/wp-includes/general-template.php src/wp-includes/general-template.php
index bb16f3e..7a01cda 100644
|
|
function paginate_links( $args = '' ) { |
3360 | 3360 | } |
3361 | 3361 | $current = (int) $args['current']; |
3362 | 3362 | $end_size = (int) $args['end_size']; // Out of bounds? Make it the default. |
3363 | | if ( $end_size < 1 ) { |
| 3363 | if ( $end_size < 0 ) { |
3364 | 3364 | $end_size = 1; |
3365 | 3365 | } |
3366 | 3366 | $mid_size = (int) $args['mid_size']; |
… |
… |
function paginate_links( $args = '' ) { |
3388 | 3388 | */ |
3389 | 3389 | $page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['prev_text'] . '</a>'; |
3390 | 3390 | endif; |
| 3391 | |
| 3392 | if( 0 === $end_size && ! $args['show_all'] ) { |
| 3393 | $dots = true; |
| 3394 | } |
| 3395 | |
3391 | 3396 | for ( $n = 1; $n <= $total; $n++ ) : |
3392 | 3397 | if ( $n == $current ) : |
3393 | 3398 | $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>"; |
diff --git tests/phpunit/tests/general/paginateLinks.php tests/phpunit/tests/general/paginateLinks.php
index 2fe9639..493dc43 100644
|
|
EXPECTED; |
321 | 321 | $page_2_url = home_url() . '?foo=2'; |
322 | 322 | $this->assertContains( "<a class='page-numbers' href='$page_2_url'>2</a>", $links ); |
323 | 323 | } |
| 324 | |
| 325 | /** |
| 326 | * @ticket 39251 |
| 327 | */ |
| 328 | public function test_paginate_links_should_support_zero_end_size() { |
| 329 | |
| 330 | $links = paginate_links( array( |
| 331 | 'total' => 10, |
| 332 | 'current' => 5, |
| 333 | 'mid_size' => 1, |
| 334 | 'end_size' => 0, |
| 335 | 'type' => 'array', |
| 336 | ) ); |
| 337 | |
| 338 | $this->assertSame( '<span class="page-numbers dots">…</span>', $links[1] ); |
| 339 | $this->assertSame( '<span class="page-numbers dots">…</span>', $links[5] ); |
| 340 | } |
324 | 341 | } |