Tribe__Tickets__Tickets_View::inject_link_template_the_content( string $content )
Injects the Link to The front-end Tickets page to non Events.
Contents
Parameters
- $content
-
(string) (Required) The content form the post.
Return
(string) $content
Source
File: src/Tribe/Tickets_View.php
public function inject_link_template_the_content( $content ) {
// Prevents firing more then it needs too outside of the loop
$in_the_loop = isset( $GLOBALS['wp_query']->in_the_loop ) && $GLOBALS['wp_query']->in_the_loop;
$post_id = get_the_ID();
$user_id = get_current_user_id();
// if the current post type doesn't have tickets enabled for it, bail
if ( ! tribe_tickets_post_type_enabled( get_post_type( $post_id ) ) ) {
return $content;
}
/**
* @todo Remove this after we implement the Rewrites in Common
*/
$is_event_query = ! empty( $GLOBALS['wp_query']->tribe_is_event_query );
// When it's not our query we don't care
if ( ( class_exists( 'Tribe__Events__Main' ) && $is_event_query ) || ! $in_the_loop ) {
return $content;
}
// If we have this we are already on the tickets page
if ( $this->is_edit_page() ) {
return $content;
}
if ( ! $this->has_rsvp_attendees( $post_id, $user_id ) && ! $this->has_ticket_attendees( $post_id, $user_id ) ) {
return $content;
}
ob_start();
include Tribe__Tickets__Templates::get_template_hierarchy( 'tickets/orders-link.php' );
$content .= ob_get_clean();
return $content;
}