[wp-trac] [WordPress Trac] #28334: Paginate_links : First link and previous link are break

WordPress Trac noreply at wordpress.org
Thu May 22 15:08:56 UTC 2014


#28334: Paginate_links : First link and previous link are break
--------------------------+-----------------------------
 Reporter:  nexurium      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.9.1
 Severity:  normal        |   Keywords:
  Focuses:  template      |
--------------------------+-----------------------------
 I have found a little bug into paginate_link function.

 The first link and the previous link ( when current is the second link )
 are broken.

 You can find my correction below :

 {{{
 Index: wp-includes/general-template.php
 ===================================================================
 --- wp-includes/general-template.php    (3.9.1)
 +++ wp-includes/general-template.php    (copie de travail)
 @@ -2456,7 +2456,7 @@
         $dots = false;

         if ( $prev_next && $current && 1 < $current ) :
 -               $link = str_replace('%_%', 2 == $current ? '' : $format,
 $base);
 +               $link = str_replace('%_%', 1 == $current ? '' : $format,
 $base);
                 $link = str_replace('%#%', $current - 1, $link);
                 if ( $add_args )
                         $link = add_query_arg( $add_args, $link );
 @@ -2477,7 +2477,7 @@
                         $dots = true;
                 else :
                         if ( $show_all || ( $n <= $end_size || ( $current
 && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n >
 $total - $end_size ) ) :
 -                               $link = str_replace('%_%', 1 == $n ? '' :
 $format, $base);
 +                               $link = str_replace('%_%', $current == $n
 ? '' : $format, $base);
                                 $link = str_replace('%#%', $n, $link);
                                 if ( $add_args )
                                         $link = add_query_arg( $add_args,
 $link );

 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28334>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list