bp_get_blogs_pagination_count()

Get the blogs pagination count.


Return Return

(string)


Source Source

File: bp-blogs/bp-blogs-template.php

function bp_get_blogs_pagination_count() {
	global $blogs_template;

	$start_num = intval( ( $blogs_template->pag_page - 1 ) * $blogs_template->pag_num ) + 1;
	$from_num  = bp_core_number_format( $start_num );
	$to_num    = bp_core_number_format( ( $start_num + ( $blogs_template->pag_num - 1 ) > $blogs_template->total_blog_count ) ? $blogs_template->total_blog_count : $start_num + ( $blogs_template->pag_num - 1 ) );
	$total     = bp_core_number_format( $blogs_template->total_blog_count );

	if ( 1 == $blogs_template->total_blog_count ) {
		$message = __( 'Viewing 1 site', 'buddypress' );
	} else {
		/* translators: 1: the site from number. 2: the site to number. 3: the total number of sites. */
		$message = sprintf( _n( 'Viewing %1$s - %2$s of %3$s site', 'Viewing %1$s - %2$s of %3$s sites', $blogs_template->total_blog_count, 'buddypress' ), $from_num, $to_num, $total );
	}

	/**
	 * Filters the "Viewing x-y of z blogs" pagination message.
	 *
	 * @since 2.7.0
	 *
	 * @param string $message  "Viewing x-y of z blogs" text.
	 * @param string $from_num Total amount for the low value in the range.
	 * @param string $to_num   Total amount for the high value in the range.
	 * @param string $total    Total amount of blogs found.
	 */
	return apply_filters( 'bp_get_blogs_pagination_count', $message, $from_num, $to_num, $total );
}


Top ↑

Changelog Changelog

Changelog
Version Description
2.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.