/**
  * Add template hierarchy to theme compat for the group directory page.
  *
  * This is to mirror how WordPress has
  * {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
  *
  * @since 1.8.0
  *
  * @param string $templates The templates from bp_get_theme_compat_templates().
  * @return array $templates Array of custom templates to look for.
  */
 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 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;
 }
/**
 * Generate the current group type message.
 *
 * @since 2.7.0
 *
 * @return string
 */
function bp_get_current_group_directory_type_message()
{
    $type_object = bp_groups_get_group_type_object(bp_get_current_group_directory_type());
    $message = sprintf(__('Viewing groups of the type: %s', 'buddypress'), '<strong>' . $type_object->labels['singular_name'] . '</strong>');
    /**
     * Filters the current group type message.
     *
     * @since 2.7.0
     *
     * @param string $message Message to filter.
     */
    return apply_filters('bp_get_current_group_type_message', $message);
}
 * @package BuddyPress
 * @subpackage bp-legacy
 */
?>

<?php 
/**
 * Fires before the display of groups from the groups loop.
 *
 * @since 1.2.0
 */
do_action('bp_before_groups_loop');
?>

<?php 
if (bp_get_current_group_directory_type()) {
    ?>
	<p class="current-group-type"><?php 
    bp_current_group_directory_type_message();
    ?>
</p>
<?php 
}
?>

<?php 
if (bp_has_groups(bp_ajax_querystring('groups'))) {
    ?>

	<div id="pag-top" class="pagination">