BP_Groups_Theme_Compat::directory_template_hierarchy( string $templates )
Add template hierarchy to theme compat for the group directory page.
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
public function directory_template_hierarchy( $templates ) { // Set up the template hierarchy. $new_templates = array(); if ( '' !== bp_get_current_group_directory_type() ) { $new_templates[] = 'groups/index-directory-type-' . sanitize_file_name( bp_get_current_group_directory_type() ) . '.php'; } $new_templates[] = 'groups/index-directory.php'; /** * Filters the Groups directory page 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_directory', $new_templates ); // 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.