bbp_get_paged

Assist pagination by returning correct page number.

Description

(int) bbp_get_paged(); 

Returns (int)

Current page number


Usage

  1. if ( !function_exists( 'bbp_get_paged' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/common/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bbp_get_paged(); 
  7.  

Defined (1)

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

/includes/common/functions.php  
  1. function bbp_get_paged() { 
  2. global $wp_query; 
  3.  
  4. // Check the query var 
  5. if ( get_query_var( 'paged' ) ) { 
  6. $paged = get_query_var( 'paged' ); 
  7.  
  8. // Check query paged 
  9. } elseif ( !empty( $wp_query->query['paged'] ) ) { 
  10. $paged = $wp_query->query['paged']; 
  11.  
  12. // Paged found 
  13. if ( !empty( $paged ) ) 
  14. return (int) $paged; 
  15.  
  16. // Default to first page 
  17. return 1;