The current implementation of
paginate_links( $args = '' ) is a bit of a mess and misses a few crucial features.
Instead of hacking core or messing around with filters that are not supposed to do what I need the function to do, I did (use it myself on several plugins) “replace” that function by basically creating a new custom function (
better_paginate_links) that I use in my plugins.
Now I would like to ask the community if the changes I made to the function in my own plugins, would be welcome in core, so we can push it.
The code is ready to be PRd, so no big work required other than review.
Nothing existing gets destroyed, only new features added.
The changes are useful for example when using Bootstrap or simply wanting more control over the HTML generated by the function.
These new args are added:
@type string $li_classes Classes to be added to each LIST element. Default: empty. Accepts: valid HTML classes. @type string $ul_classes Classes to be added to the UL element. Default: empty. Accepts: valid HTML classes. @type string $a_classes Classes to be added to each a href element. Default: empty. Accepts: valid HTML classes. @type string $current_classes Classes to be added to each span (aria current) element. Default: empty. Accepts: valid HTML classes.
This allows you to control the generated HTML lists, ul and a href classes without having to use a (totally unperformant) filter to alter the HTML produced and add eventual classes you might need for example for a proper Bootstrap Pagination.
Already done, battle tested.
Just need to PR it.
Lets see if we can gather a few votes for this. If it is generally agreed that no votes are needed, we can also just comment a yay and I can still PR it.