bp_get_groups_pagination_count

Generate the "Viewing x-y of z groups" pagination message.

Description

(string) bp_get_groups_pagination_count(); 

Returns (string)


Usage

  1. if ( !function_exists( 'bp_get_groups_pagination_count' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-groups/bp-groups-template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_get_groups_pagination_count(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-groups/bp-groups-template.php  
  1. function bp_get_groups_pagination_count() { 
  2. global $groups_template; 
  3.  
  4. $start_num = intval( ( $groups_template->pag_page - 1 ) * $groups_template->pag_num ) + 1; 
  5. $from_num = bp_core_number_format( $start_num ); 
  6. $to_num = bp_core_number_format( ( $start_num + ( $groups_template->pag_num - 1 ) > $groups_template->total_group_count ) ? $groups_template->total_group_count : $start_num + ( $groups_template->pag_num - 1 ) ); 
  7. $total = bp_core_number_format( $groups_template->total_group_count ); 
  8.  
  9. if ( 1 == $groups_template->total_group_count ) { 
  10. $message = __( 'Viewing 1 group', buddypress ); 
  11. } else { 
  12. $message = sprintf( _n( 'Viewing %1$s - %2$s of %3$s group', 'Viewing %1$s - %2$s of %3$s groups', $groups_template->total_group_count, buddypress ), $from_num, $to_num, $total ); 
  13.  
  14. /** 
  15. * Filters the "Viewing x-y of z groups" pagination message. 
  16. * @since 1.5.0 
  17. * @param string $message "Viewing x-y of z groups" text. 
  18. * @param string $from_num Total amount for the low value in the range. 
  19. * @param string $to_num Total amount for the high value in the range. 
  20. * @param string $total Total amount of groups found. 
  21. */ 
  22. return apply_filters( 'bp_get_groups_pagination_count', $message, $from_num, $to_num, $total );