bbp_get_template_part

Adds bbPress theme support to any active WordPress theme.

Description

bbp_get_template_part( (string) $slug, (null) $name = null ); 

Parameters (2)

0. $slug (string)
The slug.
1. $name — Optional. (null) => null
Default null

Usage

  1. if ( !function_exists( 'bbp_get_template_part' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/core/template-functions.php'; 
  3.  
  4. // The slug. 
  5. $slug = ''; 
  6.  
  7. // Optional. Default null 
  8. $name = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bbp_get_template_part($slug, $name); 
  12.  

Defined (1)

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

/includes/core/template-functions.php  
  1. function bbp_get_template_part( $slug, $name = null ) { 
  2.  
  3. // Execute code for this part 
  4. do_action( 'get_template_part_' . $slug, $slug, $name ); 
  5.  
  6. // Setup possible parts 
  7. $templates = array(); 
  8. if ( isset( $name ) ) 
  9. $templates[] = $slug . '-' . $name . '.php'; 
  10. $templates[] = $slug . '.php'; 
  11.  
  12. // Allow template parst to be filtered 
  13. $templates = apply_filters( 'bbp_get_template_part', $templates, $slug, $name ); 
  14.  
  15. // Return the part that is found 
  16. return bbp_locate_template( $templates, true, false );