BP_Members_Theme_Compat::directory_template_hierarchy( array $templates = array() )

Add template hierarchy to theme compat for the members directory page.

Description

This is to mirror how WordPress has template hierarchy.

Parameters

$templates

(Optional) The templates from bp_get_theme_compat_templates().

Default value: array()

Return

(array) $templates Array of custom templates to look for.

Source

File: bp-members/classes/class-bp-members-theme-compat.php

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
public function directory_template_hierarchy( $templates = array() ) {
 
    // Set up the template hierarchy.
    $new_templates = array();
    if ( '' !== bp_get_current_member_type() ) {
        $new_templates[] = 'members/index-directory-type-' . sanitize_file_name( bp_get_current_member_type() ) . '.php';
    }
    $new_templates[] = 'members/index-directory.php';
 
    /**
     * Filters the template hierarchy for theme compat and members directory page.
     *
     * @since BuddyPress 1.8.0
     *
     * @param array $value Array of template paths to add to hierarchy.
     */
    $new_templates = apply_filters( 'bp_template_hierarchy_members_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

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.