Skip to content

Instantly share code, notes, and snippets.

@skyshab
Created April 17, 2018 18:00
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 skyshab/e3b9f16a37e9da7419c3eee915a2d509 to your computer and use it in GitHub Desktop.
Save skyshab/e3b9f16a37e9da7419c3eee915a2d509 to your computer and use it in GitHub Desktop.
Example template that only shows the event image for a specific category
<?php
/**
* Photo View Single Event
* This file contains one event in the photo view
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/pro/photo/single-event.php
*
* @package TribeEventsCalendar
* @version 4.4.8
*/
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
} ?>
<?php
global $post;
?>
<div class="tribe-events-photo-event-wrap">
<?php if( is_tax( Tribe__Events__Main::TAXONOMY, 'my-target-category' ) ): ?><!-- if is category -->
<a class="tribe-event-url" href="<?php echo esc_url( tribe_get_event_link() ); ?>" title="<?php the_title() ?>" rel="bookmark">
<?php echo tribe_event_featured_image( null, 'medium' ); ?>
</a>
<?php else: ?><!-- if not category -->
<?php echo tribe_event_featured_image( null, 'medium' ); ?>
<div class="tribe-events-event-details tribe-clearfix">
<!-- Event Title -->
<?php do_action( 'tribe_events_before_the_event_title' ); ?>
<h2 class="tribe-events-list-event-title">
<a class="tribe-event-url" href="<?php echo esc_url( tribe_get_event_link() ); ?>" title="<?php the_title() ?>" rel="bookmark">
<?php the_title(); ?>
</a>
</h2>
<?php do_action( 'tribe_events_after_the_event_title' ); ?>
<!-- Event Meta -->
<?php do_action( 'tribe_events_before_the_meta' ); ?>
<div class="tribe-events-event-meta">
<div class="tribe-event-schedule-details">
<?php if ( ! empty( $post->distance ) ) : ?>
<strong>[<?php echo tribe_get_distance_with_unit( $post->distance ); ?>]</strong>
<?php endif; ?>
<?php echo tribe_events_event_schedule_details(); ?>
</div>
</div><!-- .tribe-events-event-meta -->
<?php do_action( 'tribe_events_after_the_meta' ); ?>
<!-- Event Content -->
<?php do_action( 'tribe_events_before_the_content' ); ?>
<div class="tribe-events-list-photo-description tribe-events-content">
<?php echo tribe_events_get_the_excerpt() ?>
</div>
<?php do_action( 'tribe_events_after_the_content' ) ?>
</div><!-- /.tribe-events-event-details -->
<?php endif; ?><!-- end if is category -->
</div><!-- /.tribe-events-photo-event-wrap -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment