tribe_get_event_website_link( null|object|int $event = null, null|string $label = null, string $target = '_self' )

Retrieves the website link for an event, including an optional label and target attribute.

This function returns the URL associated with the event and outputs it as an HTML anchor (<a>) element. It also allows customization of the link label and target through filters.


Parameters

$event

(null|object|int) (Optional) The event object or ID. Defaults to null - which will use global $post.

Default value: null

$label

(null|string) (Optional) The text label for the link. Defaults to the event URL if not provided.

Default value: null

$target

(string) (Optional) The target attribute for the link. Defaults to '_self'. Allowed values are: '_self', '_blank', '_parent', '_top', '_unfencedTop'.

Default value: '_self'


Top ↑

Return

(string) The HTML for the event website link, or an empty string if no URL is found.


Top ↑

Source

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

	function tribe_get_event_website_link( $event = null, $label = null ) {
		$url = tribe_get_event_website_url( $event );
		if ( ! empty( $url ) ) {
			$label = is_null( $label ) ? $url : $label;
			$html  = sprintf(
				'<a href="%s" target="%s">%s</a>',
				esc_url( $url ),
				apply_filters( 'tribe_get_event_website_link_target', '_self' ),
				apply_filters( 'tribe_get_event_website_link_label', $label )
			);
		} else {
			$html = '';
		}

		return apply_filters( 'tribe_get_event_website_link', $html );
	}

Top ↑

Changelog

Changelog
Version Description
3.0 Introduced.