WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 25 hours 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:

Description

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:

<?php
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 4 years ago.
39378.2.patch (1.4 KB) - added by jfarthing84 8 weeks ago.

Download all attachments as: .zip

Change History (10)

@jfarthing84
4 years ago

#1 @jfarthing84
4 years ago

  • Keywords has-patch added

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


2 months ago

#3 @noisysocks
2 months ago

  • Milestone changed from Awaiting Review to 5.5

#4 @markparnell
2 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?

@jfarthing84
8 weeks ago

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


7 days ago

#6 @davidbaumwald
7 days 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
25 hours ago

  • Component changed from General to Themes

#8 @SergeyBiryukov
25 hours 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.