Changeset 10184 for trunk/src/bp-groups/bp-groups-template.php
- Timestamp:
- 10/04/2015 01:47:36 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-groups/bp-groups-template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-template.php
r10160 r10184 4344 4344 4345 4345 /** 4346 * Output the contents of the current group's home page. 4347 * 4348 * You should only use this when on a single group page. 4349 * 4350 * @since 2.4.0 4351 */ 4352 function bp_groups_front_template_part() { 4353 $located = bp_groups_get_front_template(); 4354 4355 if ( false !== $located ) { 4356 $slug = str_replace( '.php', '', $located ); 4357 4358 /** 4359 * Let plugins adding an action to bp_get_template_part get it from here 4360 * 4361 * @param string $slug Template part slug requested. 4362 * @param string $name Template part name requested. 4363 */ 4364 do_action( 'get_template_part_' . $slug, $slug, false ); 4365 4366 load_template( $located, true ); 4367 4368 } else if ( bp_is_active( 'activity' ) ) { 4369 bp_get_template_part( 'groups/single/activity' ); 4370 4371 } else if ( bp_is_active( 'members' ) ) { 4372 bp_groups_members_template_part(); 4373 } 4374 4375 return $located; 4376 } 4377 4378 /** 4379 * Locate a custom group front template if it exists. 4380 * 4381 * @since 2.4.0 4382 * 4383 * @param BP_Groups_Group|null $group Optional. Falls back to current group if not passed. 4384 * @return string|bool Path to front template on success; boolean false on failure. 4385 */ 4386 function bp_groups_get_front_template( $group = null ) { 4387 if ( ! is_a( $group, 'BP_Groups_Group' ) ) { 4388 $group = groups_get_current_group(); 4389 } 4390 4391 if ( ! isset( $group->id ) ) { 4392 return false; 4393 } 4394 4395 if ( isset( $group->front_template ) ) { 4396 return $group->front_template; 4397 } 4398 4399 $template_names = apply_filters( 'bp_groups_get_front_template', array( 4400 'groups/single/front-id-' . sanitize_file_name( $group->id ) . '.php', 4401 'groups/single/front-slug-' . sanitize_file_name( $group->slug ) . '.php', 4402 'groups/single/front-status-' . sanitize_file_name( $group->status ) . '.php', 4403 'groups/single/front.php' 4404 ) ); 4405 4406 return bp_locate_template( $template_names, false, true ); 4407 } 4408 4409 /** 4346 4410 * Output the Group members template 4347 4411 *
Note: See TracChangeset
for help on using the changeset viewer.