[wp-trac] [WordPress Trac] #35696: Allow extra control over CSS Classes in paginate_links()

WordPress Trac noreply at wordpress.org
Tue Feb 2 19:21:20 UTC 2016


#35696: Allow extra control over CSS Classes in paginate_links()
--------------------------+-----------------------------
 Reporter:  maor          |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Themes        |    Version:
 Severity:  normal        |   Keywords:
  Focuses:  template      |
--------------------------+-----------------------------
 Currently, `paginate_links()` does not allow any flexibility in terms of
 customizing CSS classes in the outputted HTML.

 The idea here is to introduce some degree of control in this area.

 This idea rose from the need to implement a pagination component in
 [https://getbootstrap.com/components/#pagination Bootstrap] and Zurb's
 [http://foundation.zurb.com/sites/docs/pagination.html Foundation]. As of
 now, there is no way to implement these components without workarounds /
 hacks to `paginate_links()`.

 Currently, `paginate_links()` lets me output such HTML:

 {{{
 <ul class="page-numbers">
         <li><span class="page-numbers current">1</span></li>
         <li><a class="page-numbers"
 href="https://example.com/blog/page/2/">2</a></li>
         <li><a class="page-numbers"
 href="https://example.com/blog/page/3/">3</a></li>
         <li><a class="next page-numbers"
 href="https://example.com/blog/page/2/">Next »</a></li>
 </ul>
 }}}

 I would expect `paginate_links()` to allow me to attach custom CSS classes
 to `<ul>`, `<li>` and `<a>` elements.

 {{{
 <ul class="pagination">
         <li class="page-numbers active"><a href="#">1 <span class="sr-
 only">(current)</span></a></li>
         <li><a class="page-numbers"
 href="https://example.com/blog/page/2/">2</a></li>
         <li><a class="page-numbers"
 href="https://example.com/blog/page/3/">3</a></li>
         <li><a class="next page-numbers"
 href="https://example.com/blog/page/2/"><i class="fa fa-arrow-
 right"></i></a></li>
 </ul>
 }}}

 This will allow for much more flexibility and less dirty workarounds.

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


More information about the wp-trac mailing list