bp_messages_pagination_count()
Generate the “Viewing message x to y (of z messages)” string for a loop.
Contents
Description Description
Source Source
File: bp-messages/bp-messages-template.php
function bp_messages_pagination_count() {
global $messages_template;
$start_num = intval( ( $messages_template->pag_page - 1 ) * $messages_template->pag_num ) + 1;
$from_num = bp_core_number_format( $start_num );
$to_num = bp_core_number_format( ( $start_num + ( $messages_template->pag_num - 1 ) > $messages_template->total_thread_count ) ? $messages_template->total_thread_count : $start_num + ( $messages_template->pag_num - 1 ) );
$total = bp_core_number_format( $messages_template->total_thread_count );
if ( 1 == $messages_template->total_thread_count ) {
$message = __( 'Viewing 1 message', 'buddypress' );
} else {
$message = sprintf( _n( 'Viewing %1$s - %2$s of %3$s message', 'Viewing %1$s - %2$s of %3$s messages', $messages_template->total_thread_count, 'buddypress' ), $from_num, $to_num, $total );
}
echo esc_html( $message );
}