get_thread

The BuddyPress get thread function.

Description

get_thread( $topic_id, (null) $args = null ); 

Parameters (2)

0. $topic_id
The topic id.
1. $args — Optional. (null) => null
The args.

Usage

  1. if ( !function_exists( 'get_thread' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-topics.php'; 
  3.  
  4. // The topic id. 
  5. $topic_id = null; 
  6.  
  7. // The args. 
  8. $args = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = get_thread($topic_id, $args); 
  12.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-topics.php  
  1. function get_thread( $topic_id, $args = null ) { 
  2. $_args = func_get_args(); 
  3. $defaults = array( 'page' => 1, 'order' => 'ASC' ); 
  4. if ( is_numeric( $args ) ) 
  5. $args = array( 'page' => $args ); 
  6. if ( @$_args[2] ) 
  7. $defaults['order'] = 'DESC'; 
  8.  
  9. $args = wp_parse_args( $args, $defaults ); 
  10. $args['topic_id'] = $topic_id; 
  11.  
  12. $query = new BB_Query( 'post', $args, 'get_thread' ); 
  13. return $query->results;