bbp_get_forum_subforum_count

Return total subforum count of a forum.

Description

(int) bbp_get_forum_subforum_count( (int) $forum_id = 0, (bool) $integer = false ); 

Returns (int)

Forum's subforum count

Parameters (2)

0. $forum_id — Optional. (int)
Forum id
1. $integer — Optional. (bool) => false
Whether or not to format the result

Usage

  1. if ( !function_exists( 'bbp_get_forum_subforum_count' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/forums/template.php'; 
  3.  
  4. // Optional. Forum id 
  5. $forum_id = -1; 
  6.  
  7. // Optional. Whether or not to format the result 
  8. $integer = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bbp_get_forum_subforum_count($forum_id, $integer); 
  12.  

Defined (1)

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

/includes/forums/template.php  
  1. function bbp_get_forum_subforum_count( $forum_id = 0, $integer = false ) { 
  2. $forum_id = bbp_get_forum_id( $forum_id ); 
  3. $forum_count = (int) get_post_meta( $forum_id, '_bbp_forum_subforum_count', true ); 
  4. $filter = ( true === $integer ) ? 'bbp_get_forum_subforum_count_int' : 'bbp_get_forum_subforum_count'; 
  5.  
  6. return apply_filters( $filter, $forum_count, $forum_id );