Better control over Pagination stops#2302
Conversation
I had the case where I needed to hide the last pages of pagination (the very oldest posts). I found the `end_step` (not documented anywhere) controlled how many pages are shown at either end of the pagination range. Additionally I was not able to set this to zero to hide the pages completely. My proposal is to allow zero pages to be shown at the ends of the list. Also to enable different values for the start and end. The start value defaults to the same as the end value for backwards compatibility.
|
@IJMacD thanks for the PR! Would you be up for writing some tests in The good news is that it seems that nothing about the prior behaviors are broken. While Travis is failing right now, it's due to an unrelated issue about changes in Twig (#2301) |
|
I've added the tests and checked against the original code. I found that setting I was aware of #2301. If you need to see green ticks from the tests I can rebase if you'd like? |
|
This is great, thanks @IJMacD ! Really appreciate all the permutations of tests/sizes so we can make sure things (keep) behaving into the future. |
I had the case where I needed to hide the last pages of pagination (the very oldest posts).
I found the
end_step(not documented anywhere) controlled how many pages are shown at either end of the pagination range.Additionally I was not able to set this to zero to hide the pages completely.
My proposal is to allow zero pages to be shown at the ends of the list. Also to enable different values for the start and end. The start value defaults to the same as the end value for backwards compatibility.
Ticket: #
Issue
I needed to hide the last pages of pagination (the very oldest posts).
Solution
My solution is to add a new optional parameter to the paginate_links arg array allowing control over the start and end separately.
Also allow zero as a valid value for the ends of the list.
Impact
The new parameter defaults to the value of the old one so maintains perfect backwards compatibility.
Usage Changes
Considerations
Testing