-
-
Save bmoredrew/568a6cf97f03f14744f85b63884d3f3e to your computer and use it in GitHub Desktop.
This file contains 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 | |
/** | |
* | |
* Please see single-event.php in this directory for detailed instructions on how to use and modify these templates. | |
* | |
*/ | |
//global $post; | |
//$eventID = $post->ID; | |
$venueID = tribe_get_venue_id(); | |
?> | |
<script type="text/html" id="tribe_tmpl_tooltip"> | |
<div id="tribe-events-tooltip-[[=eventId]]" class="tribe-events-tooltip"> | |
<h4 class="entry-title summary">[[=raw title]]</h4> | |
<div class="tribe-events-event-body"> | |
<div class="tribe-event-duration"> | |
<abbr class="tribe-events-abbr tribe-event-date-start">[[=dateDisplay]] </abbr> | |
<div style="clear:both;"> | |
<?php if ( get_field( 'venue_badge', $venueID ) ) : ?> | |
<a class="btn btn-primary btn-venue-badge" href="<?php tribe_get_venue_link( $venueID, false ); ?>"> | |
<?php the_field( 'venue_badge', $venueID ); ?> | |
</a> | |
<?php endif; ?> | |
<?php echo tribe_get_venue_link(); ?> | |
</div> | |
</div> | |
[[ if(imageTooltipSrc.length) { ]] | |
<div class="tribe-events-event-thumb"> | |
<img src="[[=imageTooltipSrc]]" alt="[[=title]]" /> | |
</div> | |
[[ } ]] | |
[[ if(excerpt.length) { ]] | |
<div class="tribe-event-description">[[=raw excerpt]] | |
<p> | |
<a href="<?php echo esc_url( tribe_get_event_link() ); ?>" class="tribe-events-read-more" rel="bookmark"> | |
<?php esc_html_e( 'Find out more', 'the-events-calendar' ) ?> » | |
</a> | |
</p> | |
</div> | |
[[ } ]] | |
<div class="col-md-12 tooltip-view text-align-center" style="overflow:auto;clear:both;"> | |
<?php | |
$event_id = '[[=eventId]]'; | |
//global $post; | |
//$event_id = get_the_ID(); | |
//$event_id = $post->ID; | |
$eventParent = wp_get_post_parent_id( $event_id ); | |
wp_dump($event_id); | |
// debugging | |
echo 'single:' . $event_id . '</br>'; | |
echo 'parent:' . $eventParent . '</br>'; | |
// check to see if this event is recurring, get the parent post_id instead of actual post_id or meta is incorrect | |
if ( tribe_is_recurring_event( $event_id ) ) | |
{ | |
$event_id = $eventParent; | |
}else{ | |
$event_id = get_the_ID(); | |
} | |
// debugging | |
echo 'result:' . $event_id; | |
?> | |
<!-- date logic --> | |
<?php | |
$now = date( 'm/d/Y' ); | |
$todayDate = strtotime( $now ); | |
$regDate = strtotime( tribe_get_start_date( null, false, 'm/d/Y' ) ); | |
$regCustomDate = strtotime( get_field('register_by_date', $event_id ) ); // datepicker | |
?> | |
<!-- reference/debugging --> | |
<p>today: <?php echo $todayDate . ' - ' . $now ?></p> | |
<p>reg: <?php echo $regDate . ' - ' . tribe_get_start_date( null, false, 'm/d/Y' ) ?></p> | |
<p>custom: <?php echo $regCustomDate . ' - ' . get_field( 'register_by_date', $event_id ) ?></p> | |
<?php | |
if ( get_field( 'no_registration_required' ) ) | |
{ | |
$msg = 'No registration required'; | |
} | |
elseif ( get_field( 'register_by_date', $event_id ) && ( $todayDate < $regCustomDate ) || ( get_field('register_by_date', $event_id ) && ( $todayDate == $regCustomDate ) ) ) | |
{ | |
$msg = 'Registration open until ' . get_field( 'register_by_date', $event_id ); | |
} | |
elseif ( $todayDate < $regDate ) | |
{ | |
$msg = 'Registration open until ' . tribe_get_start_date( null, false , 'm/d/Y' ); | |
} | |
elseif ( $todayDate > $regDate ) | |
{ | |
$msg = 'Registration closed - EVENT DATE PASSED'; | |
} | |
elseif ( get_field( 'register_by_date', $event_id ) && ( $todayDate > $regCustomDate ) ) | |
{ | |
$msg = 'Registration closed - CUSTOM DATE PASSED'; | |
} | |
else | |
{ | |
$msg = 'No conditions met.'; | |
} | |
$msg = apply_filters( 'spotfin_registration_msg', $msg, $event_id ); | |
// Output message | |
echo wpautop( $msg ); | |
?> | |
<!-- button logic --> | |
<?php if ( get_field( 'no_registration_required' ) ) : ?> | |
<!-- no button --> | |
<?php elseif ( $todayDate > $regDate ) : ?> | |
<!-- no button --> | |
<?php elseif ( get_field( 'register_by_date', $event_id ) && ( $todayDate > $regCustomDate ) ) : ?> | |
<!-- no button --> | |
<?php elseif ( get_field('custom_register_url', $event_id ) ): ?> | |
<?php // field ?> | |
<a href="<?php the_field('custom_register_url'); ?>" target="_self" class="btn btn-primary btn-register" role="button"> | |
<span class="pp-button-text">REGISTER</span> | |
</a> | |
<?php else: ?> | |
<p>Missing custom register url?</p> | |
<?php endif; ?> | |
</div> | |
<span class="tribe-events-arrow"></span> | |
</div> | |
</div> | |
</script> | |
<a class="btn btn-primary btn-venue-badge" href="<?php tribe_get_venue_link( $venueID, false ); ?>"> | |
<?php the_field( 'venue_badge', $venueID ); ?> | |
</a> | |
<?php endif; ?> | |
<?php echo tribe_get_venue_link(); ?> | |
</div> | |
</div> | |
[[ if(imageTooltipSrc.length) { ]] | |
<div class="tribe-events-event-thumb"> | |
<img src="[[=imageTooltipSrc]]" alt="[[=title]]" /> | |
</div> | |
[[ } ]] | |
[[ if(excerpt.length) { ]] | |
<div class="tribe-event-description">[[=raw excerpt]] | |
<p> | |
<a href="<?php echo esc_url( tribe_get_event_link() ); ?>" class="tribe-events-read-more" rel="bookmark"> | |
<?php esc_html_e( 'Find out more', 'the-events-calendar' ) ?> » | |
</a> | |
</p> | |
</div> | |
[[ } ]] | |
<div class="col-md-12 tooltip-view text-align-center" style="overflow:auto;clear:both;"> | |
<!-- date logic --> | |
<?php | |
$now = date( 'm/d/Y' ); | |
$todayDate = strtotime( $now ); | |
$regDate = strtotime( tribe_get_start_date( null, false, 'm/d/Y' ) ); | |
$regCustomDate = strtotime( get_field('register_by_date', $event_id ) ); // datepicker | |
?> | |
<p><?php //if ( $regCustomDate < $todayDate ) { echo 'passed'; } ?></p> | |
<p><?php //if ( get_field('custom_register_url', $event_id ) && ( $regCustomDate > $todayDate ) ) { echo 'true'; } ?></p> | |
<!-- reference/debugging | |
<p>today: <?php echo $todayDate . ' - ' . $now ?></p> | |
<p>reg: <?php echo $regDate . ' - ' . tribe_get_start_date( null, false, 'm/d/Y' ) ?></p> | |
<p>custom: <?php echo $regCustomDate . ' - ' . get_field( 'register_by_date', $event_id ) ?></p> | |
--> | |
<?php | |
if ( get_field( 'no_registration_required', $event_id ) ) | |
{ | |
$msg = 'No registration required'; | |
} | |
elseif ( get_field( 'register_by_date', $event_id ) && ( $regCustomDate >= $todayDate ) || ( get_field('register_by_date', $event_id ) && ( $todayDate == $regCustomDate ) ) ) | |
{ | |
$msg = 'Registration open until ' . get_field( 'register_by_date', $event_id ); | |
} | |
elseif ( get_field( 'register_by_date', $event_id ) && ( $regCustomDate < $todayDate ) ) | |
{ | |
$msg = 'Registration closed'; | |
} | |
elseif ( $todayDate < $regDate ) | |
{ | |
$msg = 'Registration open until ' . tribe_get_start_date( null, false , 'm/d/Y' ); | |
} | |
elseif ( $todayDate > $regDate ) | |
{ | |
$msg = 'Registration closed'; | |
} | |
else | |
{ | |
//$msg = 'No conditions met.'; | |
} | |
$msg = apply_filters( 'spotfin_registration_msg', $msg, $event_id ); | |
// Output message | |
echo wpautop( $msg ); | |
?> | |
<?php | |
if ( get_field( 'no_registration_required', $event_id ) ) | |
{ | |
$btnMsg = ''; | |
} | |
elseif ( get_field('register_by_date', $event_id ) && ( $regCustomDate < $todayDate ) ) | |
{ | |
$btnMsg = ''; | |
} | |
elseif ( get_field('custom_register_url', $event_id ) && ( $regCustomDate >= $todayDate ) ) | |
{ | |
$btnMsg = '<a href="' . get_field('custom_register_url', $event_id ) . '" target="_self" class="btn btn-primary btn-register" role="button"> | |
<span class="pp-button-text">REGISTER</span> | |
</a>'; | |
} | |
elseif ( $regDate < $todayDate ) | |
{ | |
$btnMsg = ''; | |
} | |
else | |
{ | |
$btnMsg = ''; | |
} | |
echo $btnMsg; | |
?> | |
</div> | |
<span class="tribe-events-arrow"></span> | |
</div> | |
</div> | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment