bp_get_template_stack()
Get the “template stack”, a list of registered directories where templates can be found.
Description
Calls the functions added to the ‘bp_template_stack’ filter hook, and return an array of the template locations.
See also
Return
(array) The filtered value after all hooked functions are applied to it.
Source
File: bp-core/bp-core-template-loader.php
$args = $stack = array(); // Add 'bp_template_stack' to the current filter array. $wp_current_filter[] = $tag; // Sort. if ( class_exists( 'WP_Hook' ) ) { $filter = $wp_filter[ $tag ]->callbacks; } else { $filter = &$wp_filter[ $tag ]; if ( ! isset( $merged_filters[ $tag ] ) ) { ksort( $filter ); $merged_filters[ $tag ] = true; } } // Ensure we're always at the beginning of the filter array. reset( $filter ); // Loop through 'bp_template_stack' filters, and call callback functions. do { foreach( (array) current( $filter ) as $the_ ) { if ( ! is_null( $the_['function'] ) ) { $args[1] = $stack; $stack[] = call_user_func_array( $the_['function'], array_slice( $args, 1, (int) $the_['accepted_args'] ) ); } } } while ( next( $filter ) !== false ); // Remove 'bp_template_stack' from the current filter array. array_pop( $wp_current_filter ); // Remove empties and duplicates. $stack = array_unique( array_filter( $stack ) ); /** * Filters the "template stack" list of registered directories where templates can be found. * * @since BuddyPress 1.7.0 * * @param array $stack Array of registered directories for template locations. */ return (array) apply_filters( 'bp_get_template_stack', $stack ) ; } /** * Put a template part into an output buffer, and return it. * * @since BuddyPress 1.7.0
Changelog
Version | Description |
---|---|
BuddyPress 1.7.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.