diff --git src/bp-groups/bp-groups-template.php src/bp-groups/bp-groups-template.php
index be28ded..f8f7986 100644
|
|
function bp_groups_front_template_part() { |
4186 | 4186 | * Locate a custom group front template if it exists. |
4187 | 4187 | * |
4188 | 4188 | * @since 2.4.0 |
| 4189 | * @since 2.6.0 Adds the Group Type to the front template hierarchy. |
4189 | 4190 | * |
4190 | 4191 | * @param BP_Groups_Group|null $group Optional. Falls back to current group if not passed. |
4191 | 4192 | * @return string|bool Path to front template on success; boolean false on failure. |
… |
… |
function bp_groups_get_front_template( $group = null ) { |
4203 | 4204 | return $group->front_template; |
4204 | 4205 | } |
4205 | 4206 | |
| 4207 | $template_names = array( |
| 4208 | 'groups/single/front-id-' . sanitize_file_name( $group->id ) . '.php', |
| 4209 | 'groups/single/front-slug-' . sanitize_file_name( $group->slug ) . '.php', |
| 4210 | ); |
| 4211 | |
| 4212 | if ( bp_groups_get_group_types() ) { |
| 4213 | $group_type = bp_groups_get_group_type( $group->id ); |
| 4214 | if ( ! $group_type ) { |
| 4215 | $group_type = 'none'; |
| 4216 | } |
| 4217 | |
| 4218 | $template_names[] = 'groups/single/front-group-type-' . sanitize_file_name( $group_type ) . '.php'; |
| 4219 | } |
| 4220 | |
| 4221 | $template_names = array_merge( $template_names, array( |
| 4222 | 'groups/single/front-status-' . sanitize_file_name( $group->status ) . '.php', |
| 4223 | 'groups/single/front.php' |
| 4224 | ) ); |
| 4225 | |
4206 | 4226 | /** |
4207 | 4227 | * Filters the hierarchy of group front templates corresponding to a specific group. |
4208 | 4228 | * |
… |
… |
function bp_groups_get_front_template( $group = null ) { |
4212 | 4232 | * @param array $template_names Array of template paths. |
4213 | 4233 | * @param object $group Group object. |
4214 | 4234 | */ |
4215 | | $template_names = apply_filters( 'bp_groups_get_front_template', array( |
4216 | | 'groups/single/front-id-' . sanitize_file_name( $group->id ) . '.php', |
4217 | | 'groups/single/front-slug-' . sanitize_file_name( $group->slug ) . '.php', |
4218 | | 'groups/single/front-status-' . sanitize_file_name( $group->status ) . '.php', |
4219 | | 'groups/single/front.php' |
4220 | | ) ); |
4221 | | |
4222 | | return bp_locate_template( $template_names, false, true ); |
| 4235 | return bp_locate_template( apply_filters( 'bp_groups_get_front_template', $template_names, $group ), false, true ); |
4223 | 4236 | } |
4224 | 4237 | |
4225 | 4238 | /** |