Skip to:
Content

bbPress.org


Ignore:
Timestamp:
06/15/2017 02:50:58 AM (9 years ago)
Author:
johnjamesjacoby
Message:

Theme Compat: Update bbp_get_query_template() to work a bit more simply.

This change removes using the returned results from the stash functions, and uses the local variables instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/core/template-functions.php

    r6532 r6549  
    408408    $type = preg_replace( '|[^a-z0-9-]+|', '', $type );
    409409
     410    // Fallback template
    410411    if ( empty( $templates ) ) {
    411412        $templates = array( "{$type}.php" );
    412413    }
    413414
    414     // Filter possible templates, try to match one, and set any bbPress theme
    415     // compat properties so they can be cross-checked later.
     415    // Filter possible templates
    416416    $templates = apply_filters( "bbp_get_{$type}_template", $templates );
    417     $templates = bbp_set_theme_compat_templates( $templates );
    418     $template  = bbp_locate_template( $templates );
    419     $template  = bbp_set_theme_compat_template( $template );
     417
     418    // Stash the possible templates for this query, for later use
     419    bbp_set_theme_compat_templates( $templates );
     420
     421    // Try to locate a template in the stack
     422    $template = bbp_locate_template( $templates );
     423
     424    // Stash the located template for this query, for later use
     425    bbp_set_theme_compat_template( $template );
    420426
    421427    // Filter & return
    422     return apply_filters( "bbp_{$type}_template", $template );
     428    return apply_filters( "bbp_{$type}_template", $template, $templates );
    423429}
    424430
     
    429435 *
    430436 * @param array $templates Templates we are looking for
    431  * @return array Possible subfolders to look in
     437 * @return array Possible subdirectories to look in
    432438 */
    433439function bbp_get_template_locations( $templates = array() ) {
     
    464470
    465471    // Filter & return
    466     return apply_filters( 'bbp_add_template_stack_locations', array_unique( $retval ), $stacks );
     472    return (array) apply_filters( 'bbp_add_template_stack_locations', array_unique( $retval ), $stacks );
    467473}
    468474
Note: See TracChangeset for help on using the changeset viewer.