bbp_get_template_stack

Call the functions added to the 'bbp_template_stack' filter hook, and return an array of the template locations.

Description

(array) bbp_get_template_stack(); 

Returns (array)

The filtered value after all hooked functions are applied to it.


Usage

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

Defined (1)

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

/includes/core/template-functions.php  
  1. function bbp_get_template_stack() { 
  2. global $wp_filter, $merged_filters, $wp_current_filter; 
  3.  
  4. // Setup some default variables 
  5. $tag = 'bbp_template_stack'; 
  6. $args = $stack = array(); 
  7.  
  8. // Add 'bbp_template_stack' to the current filter array 
  9. $wp_current_filter[] = $tag; 
  10.  
  11. // Sort 
  12. if ( ! isset( $merged_filters[ $tag ] ) ) { 
  13. ksort( $wp_filter[$tag] ); 
  14. $merged_filters[ $tag ] = true; 
  15.  
  16. // Ensure we're always at the beginning of the filter array 
  17. reset( $wp_filter[ $tag ] ); 
  18.  
  19. // Loop through 'bbp_template_stack' filters, and call callback functions 
  20. do { 
  21. foreach ( (array) current( $wp_filter[$tag] ) as $the_ ) { 
  22. if ( ! is_null( $the_['function'] ) ) { 
  23. $args[1] = $stack; 
  24. $stack[] = call_user_func_array( $the_['function'], array_slice( $args, 1, (int) $the_['accepted_args'] ) ); 
  25. } while ( next( $wp_filter[$tag] ) !== false ); 
  26.  
  27. // Remove 'bbp_template_stack' from the current filter array 
  28. array_pop( $wp_current_filter ); 
  29.  
  30. // Remove empties and duplicates 
  31. $stack = array_unique( array_filter( $stack ) ); 
  32.  
  33. return (array) apply_filters( 'bbp_get_template_stack', $stack ) ;