Last active
December 16, 2015 09:39
-
-
Save flyarrowplane/5414230 to your computer and use it in GitHub Desktop.
Here are some changes to the list.php and single.php templates in order to display just one date and the time range.
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 | |
/* | |
////////////// SNIPPET FROM LIST.PHP | |
In the conditional below, I removed " || !tribe_get_all_day() ". Both of the conditionals were returning nothing, | |
so the second one ("not true") was catching my event. My event has the same dates, but different times. | |
*/ | |
?> | |
<?php if (tribe_is_multiday()): ?> | |
<tr> | |
<td class="tribe-events-event-meta-desc"><?php _e('Start:', 'tribe-events-calendar'); ?></td> | |
<td class="tribe-events-event-meta-value" itemprop="startDate" content="<?php echo tribe_get_start_date(); ?>"><?php echo tribe_get_start_date(); ?></td> | |
</tr> | |
<tr> | |
<td class="tribe-events-event-meta-desc"><?php _e('End:', 'tribe-events-calendar'); ?></td> | |
<td class="tribe-events-event-meta-value" itemprop="endDate" content="<?php echo tribe_get_end_date(); ?>"><?php echo tribe_get_end_date(); ?></td> | |
</tr> | |
<?php else: | |
/* | |
Previously, this part just displayed the start date and time. No end time. I modified it so the first row | |
shows the date, alone. The second row shows just the start and end times, as a range of time. | |
*/ | |
?> | |
<tr> | |
<td class="tribe-events-event-meta-desc"><?php _e('Date:', 'tribe-events-calendar'); ?></td> | |
<td class="tribe-events-event-meta-value" itemprop="startDate" content="<?php echo tribe_get_start_date(); ?>"><?php echo tribe_get_start_date($post->ID,false); ?></td> | |
</tr> | |
<tr> | |
<td class="tribe-events-event-meta-desc">Time:</td> | |
<td class="tribe-events-event-meta-value" itemprop="startDate" content="<?php echo tribe_get_start_date(); ?>"><?php echo tribe_get_start_date($post->ID,true,' ') . " - " . tribe_get_end_date($post->ID,true,' '); ?></td> | |
</tr> | |
<?php endif; ?> | |
<?php | |
/* | |
////////////// SNIPPET FROM SINGLE.PHP | |
In the first conditional below, it was checking to see if tribe_get_start_date() == tribe_get_end_date(). | |
Because my end time is different than my start time, these were not equal and my event was being treated as | |
a multi-day event. So, I added the multi-day conditional here instead. | |
In the "else" section (where I want to end up), I changed it to be like the list.php change above, so that | |
date is on one line and the time range is on the next. | |
*/ | |
?> | |
<?php if (tribe_is_multiday()) { ?> | |
<dt class="event-label event-label-start"><?php _e('Start:', 'tribe-events-calendar'); ?></dt> | |
<dd class="event-meta event-meta-start"><meta itemprop="startDate" content="<?php echo tribe_get_start_date( null, false, 'Y-m-d-h:i:s' ); ?>"/><?php echo tribe_get_start_date(); ?></dd> | |
<dt class="event-label event-label-end"><?php _e('End:', 'tribe-events-calendar'); ?></dt> | |
<dd class="event-meta event-meta-end"><meta itemprop="endDate" content="<?php echo tribe_get_end_date( null, false, 'Y-m-d-h:i:s' ); ?>"/><?php echo tribe_get_end_date(); ?></dd> | |
<?php } else { ?> | |
<dt class="event-label event-label-date"><?php _e('Date:', 'tribe-events-calendar'); ?></dt> | |
<dd class="event-meta event-meta-date"><meta itemprop="startDate" content="<?php echo tribe_get_start_date( null, false, 'Y-m-d-h:i:s' ); ?>"/><?php echo tribe_get_start_date($post->ID,false); ?></dd> | |
<dt class="event-label event-label-date">Time:</dt> | |
<dd class="event-meta event-meta-date"><meta itemprop="startDate" content="<?php echo tribe_get_start_date( null, false, 'Y-m-d-h:i:s' ); ?>"/><?php echo tribe_get_start_date($post->ID,true,' ') . " - " . tribe_get_end_date($post->ID,true,' '); ?></dd> | |
<?php } ?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment