I would like to modify some HTML stuffs in a function called pagination() in this Wordpress core file:
wp-admin/includes/class-wp-list-table.php
I have been searching for relevant hook which can be used to update HTML in the above function, but I have not found one.
Here are HTML I would like to change the last part of the followings:
protected function pagination( $which ) {
if ( empty( $this->_pagination_args ) ) {
return;
}
$total_items = $this->_pagination_args['total_items'];
$total_pages = $this->_pagination_args['total_pages'];
$infinite_scroll = false;
if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
$infinite_scroll = $this->_pagination_args['infinite_scroll'];
}
if ( 'top' === $which && $total_pages > 1 ) {
$this->screen->render_screen_reader_content( 'heading_pagination' );
}
// I would like to change this part of pagination():
$output = '<span class="displaying-num">' . sprintf(
/* translators: %s: Number of items. */
_n( '%s item', '%s items', $total_items ),
number_format_i18n( $total_items )
) . '</span>';
..........................................
...........................................etc.
It should be:
global $wp_query;
$page = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$ppp = get_query_var('posts_per_page');
$end = $ppp * $page;
$start = $end - $ppp + 1;
// $total = $wp_query->found_posts;
// echo "Showing posts $start through $end of $total total.";
$output = '<span class="displaying-num">' . "Showing $start to $end of " . sprintf(
/* translators: %s: Number of items. */
_n( '%s item', '%s items', $total_items ),
number_format_i18n( $total_items )
) . '</span>';
The above codes are used for the post list of a Custom Post Type on my WP website.
Can anyone please advise what hook should be for the above purpose?