Make WordPress Core

Opened 13 months ago

Last modified 11 months ago

#60953 new enhancement

Need new hook at paginate_links

Reported by: rpf5573's profile rpf5573 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version:
Component: General Keywords: has-patch
Focuses: template Cc:

Description

<?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.

Change History (2)

#1 @audrasjb
13 months ago

  • Keywords needs-patch added
  • Version 6.5 deleted

This ticket was mentioned in PR #6722 on WordPress/wordpress-develop by @deepakrohilla.


11 months ago
#2

  • Keywords has-patch added; needs-patch removed
Note: See TracTickets for help on using tickets.