Created
August 2, 2016 03:23
-
-
Save elimn/565e4768163f72fbcea0402ea9636e2d to your computer and use it in GitHub Desktop.
MT | ETP | Add a link to the list view for booking an event
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Adds a link to the list view for booking an event if an RSVP or Ticket is available | |
| */ | |
| function tribe_events_output_cta() { | |
| if( ! tribe_is_list_view() ) return; | |
| $event = tribe_events_get_event( null ); | |
| $event_id = isset( $event->post_parent ) ? $event->post_parent : $event->ID; | |
| if( ! tribe_events_has_tickets( $event_id ) ) return; | |
| if( tribe_events_has_soldout( $event_id ) ) return; | |
| printf( | |
| '<a href="%s" class="button alt tribe-events-cta">%s</a>', | |
| tribe_get_event_link() . '#buy-tickets', | |
| esc_html( 'Book Now', 'event-tickets-plus' ) | |
| ); | |
| } | |
| add_action( 'tribe_events_after_the_event_title', 'tribe_events_output_cta' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment