tribe_meta_event_archive_tags( null|string $label = null, string $separator = ', ', bool $echo = true )

Display the event tags in a list with links to the event tag archive.


Parameters

$label

(null|string) (Optional) The label for the term list.

Default value: null

$separator

(string) (Optional) The separator of each term.

Default value: ', '

$echo

(bool) (Optional) , Whether to echo or return the list.

Default value: true


Top ↑

Return

(string|void) The html list of tags or void if no terms.


Top ↑

Source

File: src/functions/template-tags/general.php

	function tribe_meta_event_archive_tags( $label = null, $separator = ', ', $echo = true ) {
		/**
		 * Filter whether to use the WordPress tag archive urls, default false.
		 *
		 * @since 5.16.0
		 *
		 * @param boolean Whether to use the WordPress tag archive urls.
		 */
		$use_wp_tag = apply_filters( 'tec_events_use_wordpress_tag_archive_url', false );
		if ( $use_wp_tag ) {
			return tribe_meta_event_tags( $label, $separator, $echo );
		}

		if ( ! $label ) {
			$label = esc_html__( 'Tags:', 'the-events-calendar' );
		}

		$terms = get_the_terms( get_the_ID(), 'post_tag' );

		if ( is_wp_error( $terms ) ) {
			return;
		}

		if ( empty( $terms ) ) {
			return;
		}

		$term_links = [];
		foreach ( $terms as $term ) {
			$link = tribe_events_get_url( [ 'tag' => $term->slug, 'post_type' => 'tribe_events', 'eventDisplay' => 'default' ] );
			if ( is_wp_error( $link ) ) {
				continue;
			}
			$term_links[] = '<a href="' . esc_url( $link ) . '" rel="tag">' . $term->name . '</a>';
		}

		$before = '<dt class="tribe-event-tags-label">' . $label . '</dt><dd class="tribe-event-tags">';
		$after  = '</dd>';
		$list   = $before . implode( $separator, $term_links ) . $after;

		if ( $echo ) {
			echo $list;
			return;
		}

		return $list;
	}

Top ↑

Changelog

Changelog
Version Description
5.16.0 Introduced.