Make WordPress Core

Opened 6 years ago

Last modified 5 years ago

#44419 new enhancement

Custom classes and markup for pagination

Reported by: samikeijonen's profile sami.keijonen Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Themes Keywords:
Focuses: Cc:


In most cases we can modify outputted classes and markup, so that we can have naming convention we want. Navigation is a good example.

But using the_posts_pagination() function there are no filters to modify output. For example this kind of markup and classes should be possible but I think it's not at the moment:

<nav class="pagination pagination--posts" role="navigation">
<h2 class="pagination__title screen-reader-text">Posts Navigation</h2>
    <ul class="pagination__items">
        <li class="pagination__item pagination__item--current"><span aria-current="page" class="page-numbers current">Page 1</span></li>
        <li class="pagination__item pagination__item--number"><a class="page-numbers" href="http://foxland-products.test/blog/page/2/">Page 2</a></li>
        <li class="pagination__item pagination__item--dots"><span class="page-numbers dots">…</span></li>
        <li class="pagination__item pagination__item--number"><a class="page-numbers" href="http://foxland-products.test/blog/page/5/">Page 5</a></li>
        <li class="pagination__item pagination__item--next"><a class="next page-numbers" href="http://foxland-products.test/blog/page/2/">Next page →</a></li>

To sum it up:

  • You can't add custom classes.
  • There is no way to add wrapping <li>.
  • I get lost when trying to figure out Singular-post, posts and comment pagination.

With that said I'm sure there is a way to add all these things in backwards compatible way but I need to look the code first before I can suggest something.

At first look pagination functions seems messy:)

Change History (1)

#1 @pento
5 years ago

  • Version trunk deleted
Note: See TracTickets for help on using tickets.