Template_Modifications::add_event_single_link_button()
Adds link button to event single.
Source
File: src/Tribe/Template_Modifications.php
public function add_event_single_link_button() { // don't show on password protected posts. if ( post_password_required() ) { return; } $event = tribe_get_event( get_the_ID() ); if ( ! $event instanceof \WP_Post) { return; } if ( empty( $event->virtual ) ){ return; } if ( empty( $event->virtual_should_show_embed ) ) { return; } if ( empty( $event->virtual_linked_button ) ) { return; } if ( empty( $event->virtual_url ) ) { return; } // Don't show if requires log in and user isn't logged in. if ( ! $this->should_show_virtual_content( $event ) ) { return; } /** * Filters whether the link button should open in a new window or not. * * @since 1.0.0 * * @param boolean $new_window If link button should open in new window. */ $new_window = apply_filters( 'tribe_events_virtual_link_button_new_window', false ); $attrs = []; if ( ! empty( $new_window ) ) { $attrs['target'] = '_blank'; } $context = [ 'url' => $event->virtual_url, 'label' => $event->virtual_linked_button_text, 'attrs' => $attrs, ]; $this->template->template( 'components/link-button', $context ); }
Changelog
Version | Description |
---|---|
1.0.4 | Added possible login requirement. |
1.0.0 | Introduced. |