diff --git src/bp-core/bp-core-template-loader.php src/bp-core/bp-core-template-loader.php
index 89ee7b7..5df0ded 100644
|
|
function bp_load_theme_functions() { |
442 | 442 | * @return array Array of possible root level wrapper template files. |
443 | 443 | */ |
444 | 444 | function bp_get_theme_compat_templates() { |
445 | | $templates = array( |
| 445 | $page_id = 0; |
| 446 | $page_template = array(); |
| 447 | |
| 448 | // Get the WordPress Page ID for the current view. |
| 449 | foreach ( (array) buddypress()->pages as $component => $bp_page ) { |
| 450 | |
| 451 | // Handles the majority of components. |
| 452 | if ( bp_is_current_component( $component ) ) { |
| 453 | $page_id = (int) $bp_page->id; |
| 454 | } |
| 455 | |
| 456 | // Stop if not on a user page. |
| 457 | if ( ! bp_is_user() && ! empty( $page_id ) ) { |
| 458 | break; |
| 459 | } |
| 460 | |
| 461 | // The Members component requires an explicit check due to overlapping components. |
| 462 | if ( bp_is_user() && 'members' === $component ) { |
| 463 | $page_id = (int) $bp_page->id; |
| 464 | break; |
| 465 | } |
| 466 | } |
| 467 | |
| 468 | if ( $page_id ) { |
| 469 | // If the WP Page has a Page Template set, let's add it to the stack. |
| 470 | $template_file = get_page_template_slug( $page_id ); |
| 471 | |
| 472 | if ( $template_file ) { |
| 473 | $page_template = array( $template_file ); |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | $primary_templates = array( |
446 | 478 | 'plugin-buddypress.php', |
447 | 479 | 'buddypress.php', |
448 | 480 | 'community.php', |
449 | 481 | 'generic.php', |
| 482 | ); |
| 483 | |
| 484 | $fallback_templates = array( |
450 | 485 | 'page.php', |
451 | 486 | 'single.php', |
452 | 487 | 'index.php' |
453 | 488 | ); |
454 | | return bp_get_query_template( 'buddypress', $templates ); |
| 489 | |
| 490 | return bp_get_query_template( 'buddypress', array_merge( |
| 491 | $primary_templates, |
| 492 | $page_template, |
| 493 | $fallback_templates |
| 494 | ) ); |
455 | 495 | } |