Skip to:
Content

bbPress.org

Changeset 4264


Ignore:
Timestamp:
10/22/2012 10:40:31 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Theme Compat:

  • Add 'bbp_add_template_locations' filter to 'bbp_locate_template' filter.
  • Add array_unique() to bbp_add_template_locations() to remove possible duplicates.
Location:
trunk/includes/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/core/filters.php

    r4249 r4264  
    170170
    171171// Filter bbPress template locations
     172add_filter( 'bbp_locate_template',           'bbp_add_template_locations' );
    172173add_filter( 'bbp_get_template_part',         'bbp_add_template_locations' );
    173174add_filter( 'bbp_get_profile_template',      'bbp_add_template_locations' );
  • trunk/includes/core/template-functions.php

    r4249 r4264  
    6666    $parent_theme   = get_template_directory();
    6767    $fallback_theme = bbp_get_theme_compat_dir();
     68
     69    // Allow templates to be filtered
     70    // bbPress core automatically adds bbp_add_template_locations()
     71    $template_names = apply_filters( 'bbp_locate_template', $template_names );
    6872
    6973    // Try to find a template file
     
    164168
    165169    // Loop through locations and templates and combine
    166     foreach ( $locations as $location )
    167         foreach ( $templates as $template )
    168             $retval[] = trailingslashit( $location ) . $template;
    169 
    170     return apply_filters( 'bbp_add_template_locations', $retval, $templates );
     170    foreach ( (array) $locations as $location )
     171        foreach ( (array) $templates as $template )
     172            $retval[] = ltrim( trailingslashit( $location ) . $template, '/' );
     173
     174    return apply_filters( 'bbp_add_template_locations', array_unique( $retval ), $templates );
    171175}
    172176
Note: See TracChangeset for help on using the changeset viewer.