Opened 9 years ago
Last modified 5 years ago
#39251 new defect (bug)
Support end_size=0 in paginate_links()
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Future Release | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | General | Keywords: | has-patch has-unit-tests |
| Focuses: | Cc: |
Description (last modified by )
Passing end_size=0 produces one link when I'd expect it to produce zero links.
When using paginate_links() on the homepage of a site with thousands of posts, having an end size link of 1885, etc. is a bit crazy.
Attachments (1)
Change History (5)
#3
@
8 years ago
- Keywords has-patch has-unit-tests added; needs-patch needs-unit-tests removed
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 39251.patch it generates:
Previous ... 4 [5] 6 ... Next
PS:
We might get a better 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 loud, I wonder if it would be 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 more suitable than a walker.
But maybe it would be too much ;-)
Note: See
TracTickets for help on using
tickets.
+1