[wp-trac] [WordPress Trac] #60953: Need new hook at paginate_links

WordPress Trac noreply at wordpress.org
Mon Apr 8 03:32:07 UTC 2024


#60953: Need new hook at paginate_links
-------------------------+-----------------------------
 Reporter:  rpf5573      |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:  6.5
 Severity:  minor        |   Keywords:
  Focuses:  template     |
-------------------------+-----------------------------
 {{{#!php
 <?php
 function paginate_links( $args = '' ) {
     // Setting up default values and parsing arguments
     // ...

     $page_links = array();

     // Generating page links
     // ...

     switch ( $args['type'] ) {
         case 'array':
             // HERE: We need to add a filter hook before returning
 $page_links
             return $page_links;

         case 'list':
             // Generating HTML list output
             // ...
             break;

         default:
             // Generating plain HTML output
             // ...
             break;
     }

     // Applying filters to the HTML output
     // ...

     return $r;
 }
 }}}


 When the 'type' argument is set to 'array', it's necessary to introduce a
 filter hook before returning the $page_links array. This filter hook will
 enable developers to customize the array of page links before the
 paginate_links function returns it.

 For instance, we can enhance the pagination by including "10-page
 movement" anchors, resulting in a pagination structure like this:

 `<< < 1 2 3 4 5 6 7 8 9 10 > >>`

 In this example, the `<<` button allows users to navigate to the previous
 set of 10 pages, while the `>>` button enables them to jump to the next
 set of 10 pages.

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


More information about the wp-trac mailing list