Opened 11 years ago
Closed 11 years ago
#32226 closed enhancement (duplicate)
'get_the_posts_pagination' Filter
| Reported by: | ixkaito | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Permalinks | Version: | 4.1 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | template |
Description
Apply filters before returning $navigation to easily customize get_the_posts_pagination().
For example: removing \n in the markup.
function my_get_the_post_pagination( $navigation, $links, $args ) {
$links = str_replace("\n", '', $links);
if ( $links ) {
$navigation = _navigation_markup( $links, 'pagination', $args['screen_reader_text'] );
}
return $navigation;
}
add_filter( 'get_the_post_pagination', 'my_get_the_post_pagination', 10, 3 );
the_posts_pagination();
Attachments (1)
Change History (4)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
I made a typo in the sample code. The correct one is the following.
function my_get_the_posts_pagination( $navigation, $links, $args ) { $links = str_replace("\n", '', $links); if ( $links ) { $navigation = _navigation_markup( $links, 'pagination', $args['screen_reader_text'] ); } return $navigation; } add_filter( 'get_the_posts_pagination', 'my_get_the_posts_pagination', 10, 3 ); the_posts_pagination();