Skip to:
Content

BuddyPress.org

Ticket #4656: bp_locate_template.01.patch

File bp_locate_template.01.patch, 2.1 KB (added by r-a-y, 12 years ago)
  • bp-core/bp-core-filters.php

    add_filter( 'bp_template_include', 'bp_template_include_theme_supports', 2, 1 ); 
    6262add_filter( 'bp_template_include', 'bp_template_include_theme_compat',   4, 2 );
    6363
    6464// Run all template parts through additional template locations
    65 add_filter( 'bp_locate_template',   'bp_add_template_locations' );
    6665add_filter( 'bp_get_template_part', 'bp_add_template_locations' );
    6766
    6867// Turn comments off for BuddyPress pages
  • bp-core/bp-core-template-loader.php

    function bp_locate_template( $template_names, $load = false, $require_once = tru 
    6464        $located            = false;
    6565        $template_locations = bp_get_template_stack();
    6666
    67         // Try to find a template file
    68         foreach ( (array) $template_names as $template_name ) {
     67        // Loop through template stack
     68        foreach ( (array) $template_locations as $template_location ) {
    6969
    70                 // Continue if template is empty
    71                 if ( empty( $template_name ) )
     70                // Continue if $template_location is empty
     71                if ( empty( $template_location ) )
    7272                        continue;
    7373
    74                 // Trim off any slashes from the template name
    75                 $template_name  = ltrim( $template_name, '/' );
     74                // Try to find a template file
     75                foreach ( (array) $template_names as $template_name ) {
    7676
    77                 // Loop through template stack
    78                 foreach ( (array) $template_locations as $template_location ) {
    79 
    80                         // Continue if $template_location is empty
    81                         if ( empty( $template_location ) )
     77                        // Continue if template is empty
     78                        if ( empty( $template_name ) )
    8279                                continue;
    8380
    84                         // Check child theme first
     81                        // Trim off any slashes from the template name
     82                        $template_name  = ltrim( $template_name, '/' );
     83
     84                        // See if template exists
    8585                        if ( file_exists( trailingslashit( $template_location ) . $template_name ) ) {
    8686                                $located = trailingslashit( $template_location ) . $template_name;
    8787                                break 2;