Skip to content

Commit 29a983c

Browse files
authored
Update pagination dots
Currently, under certain conditions the pagination shows dots when it would make more sense to show a number. This change updates such an edge case. # Example: If you have the following variables: Mid size: 2 End size: 1 Total pages: 5 Current page: 1 Then it will visually output as follows: Prev 1 2 3 ... 5 Next
1 parent 164b22c commit 29a983c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/wp-includes/general-template.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4299,7 +4299,7 @@ function paginate_links( $args = '' ) {
42994299

43004300
$dots = true;
43014301
else :
4302-
if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
4302+
if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size || (( in_array($current,array(1, $total))) && ($total - ($mid_size + ($end_size * 2))) === 1 ) ) ) :
43034303
$link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] );
43044304
$link = str_replace( '%#%', $n, $link );
43054305
if ( $add_args ) {

0 commit comments

Comments
 (0)