BP_Groups_Theme_Compat::single_template_hierarchy( string $templates )
Add custom template hierarchy to theme compat for group pages.
Description
This is to mirror how WordPress has template hierarchy.
Parameters
- $templates
-
(Required) The templates from bp_get_theme_compat_templates().
Return
(array) $templates Array of custom templates to look for.
Source
File: bp-groups/classes/class-bp-groups-theme-compat.php
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | public function single_template_hierarchy( $templates ) { // Setup some variables we're going to reference in our custom templates. $group = groups_get_current_group(); /** * Filters the Groups single pages template hierarchy based on priority. * * @since BuddyPress 1.8.0 * * @param array $value Array of default template files to use. */ $new_templates = apply_filters( 'bp_template_hierarchy_groups_single_item' , array ( 'groups/single/index-id-' . sanitize_file_name( bp_get_current_group_id() ) . '.php' , 'groups/single/index-slug-' . sanitize_file_name( bp_get_current_group_slug() ) . '.php' , 'groups/single/index-action-' . sanitize_file_name( bp_current_action() ) . '.php' , 'groups/single/index-status-' . sanitize_file_name( $group ->status ) . '.php' , 'groups/single/index.php' ) ); // Merge new templates with existing stack. // @see bp_get_theme_compat_templates(). $templates = array_merge ( ( array ) $new_templates , $templates ); return $templates ; } |
Changelog
Version | Description |
---|---|
BuddyPress 1.8.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.