[wp-trac] [WordPress Trac] #37056: paginate_links should be a method on WP_Query
WordPress Trac
noreply at wordpress.org
Thu Nov 24 19:02:41 UTC 2016
#37056: paginate_links should be a method on WP_Query
-------------------------+------------------------------
Reporter: jfarthing84 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 4.6
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------+------------------------------
Comment (by xavivars):
I'd even go further, and have a function (or static method) so you provide
the the base URL, the current and total pages, and other stuff like the
format to use on the pages,... and then have that method used by the
current `paginate_links()` method (to keep backwards compatiblity).
That would make it much easier to reuse the logic of the pagination in
other places (like plugins, or
[https://github.com/timber/timber/blob/master/lib/Pagination.php Timber])
relying on core code, so no more ugly code needs to be written to simulate
that behaviour.
That would also make it much easier to unit test (no need to setup too
much WordPress global stuff, but relying on input parameters only.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37056#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list