bbp_get_forum_index_pagination_count()
Return the forum index pagination count
Description
Return
(string) Forum Pagintion count
Source
File: bp-forums/forums/template.php
887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 | function bbp_get_forum_index_pagination_count() { $bbp = bbpress(); if ( empty ( $bbp ->forum_query ) ) return false; // Set pagination values $start_num = intval ( ( $bbp ->forum_query->paged - 1 ) * $bbp ->forum_query->posts_per_page ) + 1; $from_num = bbp_number_format( $start_num ); $to_num = bbp_number_format( ( $start_num + ( $bbp ->forum_query->posts_per_page - 1 ) > $bbp ->forum_query->found_posts ) ? $bbp ->forum_query->found_posts : $start_num + ( $bbp ->forum_query->posts_per_page - 1 ) ); $total_int = (int) ! empty ( $bbp ->forum_query->found_posts ) ? $bbp ->forum_query->found_posts : $bbp ->forum_query->post_count; $total = bbp_number_format( $total_int ); // Several forums in a forum index with a single page if ( empty ( $to_num ) ) { $retstr = sprintf( _n( 'Viewing %1$s forum' , 'Viewing %1$s forums' , $total_int , 'buddyboss' ), $total ); // Several forums in a forum index with several pages } else { $retstr = sprintf( _n( 'Viewing %2$s of %4$s forums' , 'Viewing %2$s - %3$s of %4$s forums' , $total_int , 'buddyboss' ), $bbp ->forum_query->post_count, $from_num , $to_num , $total ); } // Filter and return return apply_filters( 'bbp_get_forum_index_pagination_count' , esc_html( $retstr ) ); } |
Changelog
Version | Description |
---|---|
bbPress (r2519) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.