bp_get_group_type_directory_link( string $group_type = '' )

Return group type directory link.


Parameters Parameters

$group_type

(string) (Optional) Unique group type identifier as used in bp_groups_register_group_type().

Default value: ''


Top ↑

Return Return

(string)


Source Source

File: bp-groups/bp-groups-template.php

	function bp_get_group_type_directory_link( $group_type = '' ) {
		if ( empty( $group_type ) ) {
			return '';
		}

		$group_type_object = bp_groups_get_group_type_object( $group_type );

		if ( ! isset( $group_type_object->labels['name'] ) ) {
			return '';
		}

		$group_type_text = $group_type_object->labels['name'];
		if ( isset( $group_type_object->labels['singular_name'] ) && $group_type_object->labels['singular_name'] ) {
			$group_type_text = $group_type_object->labels['singular_name'];
		}

		if ( empty( $group_type_object->has_directory ) ) {
			return esc_html( $group_type_text );
		}

		return sprintf(
			'<a href="%s">%s</a>',
			esc_url( bp_get_group_type_directory_permalink( $group_type ) ),
			esc_html( $group_type_text )
		);
	}


Top ↑

Changelog Changelog

Changelog
Version Description
2.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.