[wp-trac] [WordPress Trac] #39251: Support end_size=0 in paginate_links()

WordPress Trac noreply at wordpress.org
Sat Sep 16 17:52:13 UTC 2017


#39251: Support end_size=0 in paginate_links()
--------------------------------------+-----------------------------
 Reporter:  danielbachhuber           |       Owner:
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Future Release
Component:  General                   |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-----------------------------
Changes (by birgire):

 * keywords:  needs-patch needs-unit-tests => has-patch has-unit-tests


Comment:

 This:

 {{{
 $links = paginate_links( array(
     'total'         => 10,
     'current'       => 5,
     'mid_size'      => 1,
     'end_size'      => 0,
 ) );

 }}}

 will generate:

 {{{
 Previous 1 ... 4 [5] 6 ... 10 Next

 }}}

 but with [attachment:39251.patch] it generates:

 {{{
 Previous ... 4 [5] 6 ... Next

 }}}

 PS:

 We might get a more control if we supported e.g. arrays like:

 {{{
 'end_size' => array( 1, 0 ),   // left and right parts
 'mid_size' => array( 1, 2 ),     // left and right parts

 }}}

 to generate:

 {{{
 Previous 1 ... 4 [5] 6 7 ... Next

 }}}


 Just thinking out aloud, I wonder if it would make it more flexible with
 e.g.

 {{{
 echo paginate_links( array(
         'walker'        => new RomanNumeralsPaginator,
 ) );

 }}}

 where the default paginator class would handle paginating objects and
 mimic some parts of the wp_nav_menu().

 ... or something else than a walker.

 But maybe it would be too much ;-)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39251#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list