[wp-trac] [WordPress Trac] #44419: Custom classes and markup for pagination

WordPress Trac noreply at wordpress.org
Thu Jun 21 04:55:54 UTC 2018


#44419: Custom classes and markup for pagination
---------------------------+-----------------------------
 Reporter:  sami.keijonen  |      Owner:  (none)
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Themes         |    Version:  trunk
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 In most cases we can modify outputted classes and markup, so that we can
 have naming convention we want. [https://webdesign.tutsplus.com/tutorials
 /quick-tip-bem-naming-and-wordpress-filters-for-navigation--
 cms-31268?_ga=2.172652963.1871067249.1529556196-1741110366.1504949040
 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>
     </ul>
 </nav>
 }}}

 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:)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44419>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list