bb_get_page_number

The BuddyPress bb get page number function.

Description

bb_get_page_number( $item, (int) $per_page = 0 ); 

Parameters (2)

0. $item
The item.
1. $per_page — Optional. (int)
The per page.

Usage

  1. if ( !function_exists( 'bb_get_page_number' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-core.php'; 
  3.  
  4. // The item. 
  5. $item = null; 
  6.  
  7. // The per page. 
  8. $per_page = -1; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bb_get_page_number($item, $per_page); 
  12.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-core.php  
  1. function bb_get_page_number( $item, $per_page = 0 ) { 
  2. if ( !$per_page ) 
  3. $per_page = bb_get_option('page_topics'); 
  4. return intval( ceil( $item / $per_page ) ); // page 1 is the first page