bbp_buffer_template_part

Get a template part in an output buffer, and return it.

Description

(string) bbp_buffer_template_part( (string) $slug, (constant) $name = null, (bool) $echo = true ); 

Returns (string)

Parameters (3)

0. $slug (string)
The slug.
1. $name — Optional. (constant) => null
The name.
2. $echo — Optional. (bool) => true
The echo.

Usage

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

Defined (1)

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

/includes/core/template-functions.php  
  1. function bbp_buffer_template_part( $slug, $name = null, $echo = true ) { 
  2. ob_start(); 
  3.  
  4. bbp_get_template_part( $slug, $name ); 
  5.  
  6. // Get the output buffer contents 
  7. $output = ob_get_clean(); 
  8.  
  9. // Echo or return the output buffer contents 
  10. if ( true === $echo ) { 
  11. echo $output; 
  12. } else { 
  13. return $output;