bbp_get_query_template
Retrieve path to a template.
Description
Used to quickly retrieve the path of a template without including the file extension. It will also check the parent theme and theme-compat theme with the use of . Allows for more generic template locations without the use of the other get_*_template(…) functions.
Returns (string)
Full path to file.
Parameters (2)
- 0. $type (string)
- Filename without extension.
- 1. $templates — Optional. (array) =>
array()
- An optional list of template candidates
Usage
if ( !function_exists( 'bbp_get_query_template' ) ) { require_once ABSPATH . PLUGINDIR . 'bbpress/includes/core/template-functions.php'; } // Filename without extension. $type = ''; // An optional list of template candidates $templates = array(); // NOTICE! Understand what this does before running. $result = bbp_get_query_template($type, $templates);
Defined (1)
The function is defined in the following location(s).
- /includes/core/template-functions.php
- function bbp_get_query_template( $type, $templates = array() ) {
- $type = preg_replace( '|[^a-z0-9-]+|', '', $type );
- if ( empty( $templates ) )
- $templates = array( "{$type}.php" );
- // Filter possible templates, try to match one, and set any bbPress theme
- // compat properties so they can be cross-checked later.
- $templates = apply_filters( "bbp_get_{$type}_template", $templates );
- $templates = bbp_set_theme_compat_templates( $templates );
- $template = bbp_locate_template( $templates );
- $template = bbp_set_theme_compat_template( $template );
- return apply_filters( "bbp_{$type}_template", $template );
- }