bp_add_template_stack_locations

Add template locations to template files being searched for.

Description

(array) bp_add_template_stack_locations( (array) $stacks = array() ); 

Returns (array)

Array of all template locations registered so far.

Parameters (1)

0. $stacks — Optional. (array) => array()
Array of template locations.

Usage

  1. if ( !function_exists( 'bp_add_template_stack_locations' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-template-loader.php'; 
  3.  
  4. // Array of template locations. 
  5. $stacks = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_add_template_stack_locations($stacks); 
  9.  

Defined (1)

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

/bp-core/bp-core-template-loader.php  
  1. function bp_add_template_stack_locations( $stacks = array() ) { 
  2. $retval = array(); 
  3.  
  4. // Get alternate locations. 
  5. $locations = bp_get_template_locations(); 
  6.  
  7. // Loop through locations and stacks and combine. 
  8. foreach ( (array) $stacks as $stack ) { 
  9. foreach ( (array) $locations as $custom_location ) { 
  10. $retval[] = untrailingslashit( trailingslashit( $stack ) . $custom_location ); 
  11.  
  12. /** 
  13. * Filters the template locations to template files being searched for. 
  14. * @since 1.7.0 
  15. * @param array $value Array of all template locations registered so far. 
  16. * @param array $stacks Array of template locations. 
  17. */ 
  18. return apply_filters( 'bp_add_template_stack_locations', array_unique( $retval ), $stacks );