wp-event-manager
wp-event-manager copied to clipboard
Bug
I notice in most of your templates, you use a code construct like this (this one from content-event_listing.php):
There are no conditions under which this will be true becuase your dates include the time. That is why the code always displays end date even when it ends on the same day as it starts. This code never effectively does anything.
You need to remove the time component and compare only the day not the datetime.
Here is how I fixed it....
<div class="wpem-event-details">
<div class="wpem-event-title"><h3 class="wpem-heading-text"><?php echo esc_html(get_the_title()); ?></h3></div>
<div class="wpem-event-date-time">
<span class="wpem-event-date-time-text">
<?php
display_event_start_date();
if (!empty($start_time)) {
display_date_time_separator();
}
display_event_start_time();
if (isset($start_date) && isset($end_date)) {
$test_start_date = date_i18n('Y-m-d', strtotime($start_date));
$test_end_date = date_i18n('Y-m-d', strtotime($end_date));
if ($test_start_date != $test_end_date) {
echo " to ";
display_event_end_date();
echo " "; //the function should output this!
display_date_time_separator();
echo " "; //the function should output this!
if (!empty($end_date) && !empty($end_time)){
display_event_end_time();
}
}
}
?>
</span>
</div>