64 | | // Run all template parts through additional template locations |
65 | | add_filter( 'bp_locate_template', 'bp_add_template_locations' ); |
66 | | add_filter( 'bp_get_template_part', 'bp_add_template_locations' ); |
| 64 | /** |
| 65 | * Adds custom locations as set in {@link bp_get_template_locations()} to |
| 66 | * BuddyPress' template stack. |
| 67 | * |
| 68 | * @since BuddyPress (1.7) |
| 69 | * |
| 70 | * @uses bp_get_template_locations() Get the possible subdirectories to check for templates in |
| 71 | * @return array All possible locations a template can reside in |
| 72 | */ |
| 73 | function bp_template_stack_add_custom_locations( $stacks ) { |
| 74 | $locations = array(); |
| 75 | |
| 76 | foreach ( $stacks as $stack ) { |
| 77 | // for each stack, add our custom location |
| 78 | foreach ( bp_get_template_locations() as $custom_location ) { |
| 79 | $locations[] = untrailingslashit( trailingslashit( $stack ) . $custom_location ); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | return $locations; |
| 84 | } |
| 85 | add_filter( 'bp_get_template_stack', 'bp_template_stack_add_custom_locations' ); |