Make WordPress Core

Opened 5 years ago

Closed 13 months ago

#39378 closed enhancement (fixed)

Allow passing custom class to the post pagination functions

Reported by: jfarthing84 Owned by: SergeyBiryukov
Milestone: 5.5 Priority: normal
Severity: normal Version: 4.7
Component: Themes Keywords: has-patch
Focuses: Cc:


The functions the_posts_pagination() and get_the_posts_pagination() should accept a class to be used instead of only defaulting to .pagination.

If anyone wishes to achieve this meanwhile, it must be done with the navigation_markup_template filter, unfortunately:

function navigvation_markup_template_filter( $template, $class ) {
        if ( 'pagination' == $class ) {
                $template = str_replace( '%1$s', 'posts-pagination', $template );
        return $template;
add_filter( 'navigation_markup_template', 'navigvation_markup_template_filter', 10, 2 );

Attachments (2)

39378.patch (1.3 KB) - added by jfarthing84 5 years ago.
39378.2.patch (1.4 KB) - added by jfarthing84 15 months ago.

Download all attachments as: .zip

Change History (10)

5 years ago

#1 @jfarthing84
5 years ago

  • Keywords has-patch added

This ticket was mentioned in Slack in #core by noisysocks. View the logs.

15 months ago

#3 @noisysocks
15 months ago

  • Milestone changed from Awaiting Review to 5.5

#4 @markparnell
15 months ago

  • Keywords needs-refresh added

@jfarthing84 this came up in a bug scrub today - looks like a worthwhile addition, but the patch no longer applies cleanly. Are you able to update it against trunk?

This ticket was mentioned in Slack in #core by david.baumwald. View the logs.

13 months ago

#6 @davidbaumwald
13 months ago

  • Keywords needs-refresh removed

Latest patch looks good and applies cleanly now. Seems ready to move forward in 5.5, if this can catch a quick review.

#7 @SergeyBiryukov
13 months ago

  • Component changed from General to Themes

#8 @SergeyBiryukov
13 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 48378:

Themes: Allow passing a custom class to post and comment pagination functions.

This affects:

  • get_the_post_navigation()
  • get_the_posts_navigation()
  • get_the_posts_pagination()
  • get_the_comments_navigation()
  • get_the_comments_pagination()

Props jfarthing84, markparnell, davidbaumwald, SergeyBiryukov.
Fixes #39378.

Note: See TracTickets for help on using tickets.