bbp_get_search_pagination_count()
Return the search results pagination count
Description Description
Return Return
(string) Search pagination count
Source Source
File: includes/search/template.php
function bbp_get_search_pagination_count() { $bbp = bbpress(); // Define local variable(s) $retstr = ''; // Set pagination values $total_int = intval( $bbp->search_query->found_posts ); $ppp_int = intval( $bbp->search_query->posts_per_page ); $start_int = intval( ( $bbp->search_query->paged - 1 ) * $ppp_int ) + 1; $to_int = intval( ( $start_int + ( $ppp_int - 1 ) > $total_int ) ? $total_int : $start_int + ( $ppp_int - 1 ) ); // Format numbers for display $total_num = bbp_number_format( $total_int ); $from_num = bbp_number_format( $start_int ); $to_num = bbp_number_format( $to_int ); // Single page of results if ( empty( $to_num ) ) { $retstr = sprintf( _n( 'Viewing %1$s result', 'Viewing %1$s results', $total_int, 'bbpress' ), $total_num ); // Several pages of results } else { $retstr = sprintf( _n( 'Viewing %2$s results (of %4$s total)', 'Viewing %1$s results - %2$s through %3$s (of %4$s total)', $bbp->search_query->post_count, 'bbpress' ), $bbp->search_query->post_count, $from_num, $to_num, $total_num ); } // Filter & return return apply_filters( 'bbp_get_search_pagination_count', esc_html( $retstr ) ); }
Changelog Changelog
Version | Description |
---|---|
2.3.0 | Introduced. |