Skip to content

Instantly share code, notes, and snippets.

@lelandf
Last active March 9, 2022 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lelandf/99068384b3a4fd9ef077318c04c1d67a to your computer and use it in GitHub Desktop.
Save lelandf/99068384b3a4fd9ef077318c04c1d67a to your computer and use it in GitHub Desktop.
Override of list event template with "Book Now" button.
<?php
/**
* View: List Event
*
* Override this template in your own theme by creating a file at:
* [your-theme]/tribe/events/v2/list/event.php
*
* See more documentation about our views templating system.
*
* @link http://evnt.is/1aiy
*
* @version 5.0.0
*
* @var WP_Post $event The event post object with properties added by the `tribe_get_event` function.
*
* @see tribe_get_event() For the format of the event object.
*/
$container_classes = [ 'tribe-common-g-row', 'tribe-events-calendar-list__event-row' ];
$container_classes['tribe-events-calendar-list__event-row--featured'] = $event->featured;
$event_classes = tribe_get_post_class( [ 'tribe-events-calendar-list__event', 'tribe-common-g-row', 'tribe-common-g-row--gutters' ], $event->ID );
?>
<div <?php tribe_classes( $container_classes ); ?>>
<?php $this->template( 'list/event/date-tag', [ 'event' => $event ] ); ?>
<div class="tribe-events-calendar-list__event-wrapper tribe-common-g-col">
<article <?php tribe_classes( $event_classes ) ?>>
<?php $this->template( 'list/event/featured-image', [ 'event' => $event ] ); ?>
<div class="tribe-events-calendar-list__event-details tribe-common-g-col">
<header class="tribe-events-calendar-list__event-header">
<?php $this->template( 'list/event/date', [ 'event' => $event ] ); ?>
<?php $this->template( 'list/event/title', [ 'event' => $event ] ); ?>
<?php $this->template( 'list/event/venue', [ 'event' => $event ] ); ?>
</header>
<?php /* CUSTOMIZATION STARTS HERE */ ?>
<div class="book-now-button">
<a class="book-now-button__link tribe-common-c-btn" href="<?php echo esc_url( $event->permalink ); ?>">Book Now</a>
</div>
<?php /* CUSTOMIZATION ENDS HERE */ ?>
<?php $this->template( 'list/event/description', [ 'event' => $event ] ); ?>
<?php $this->template( 'list/event/cost', [ 'event' => $event ] ); ?>
</div>
</article>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment