Hi, I have some old PHP code I am trying to sort through and it is for pulling 3 upcoming events and I guess it was written so todays event doesn't show and am trying to fix that. I was wondering if anyone can make sense of this?
I was thinking it has to do with the following lines in the script above but not entirely sure?
Would appreciate some help with this if possible. Thanks!
PHP:
<ul>
<?php $urlSplits = explode('/', $_SERVER['REQUEST_URI']); ?>
<?php
if ($urlSplits[3] != '') {
$currentYear = $urlSplits[3];
} else {
$currentYear = date('Y');
}
?>
<?php query_posts('cat=3&order=DESC');?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php
$eventDate = get_field('start-date', $post->ID);
$eventDate = str_replace(', ', ' ', $eventDate);
$eventDate = strtotime($eventDate);
$eventDateArray[] = $eventDate;
$eventPIDArray[] = $post->ID;
?>
<?php endwhile; ?>
<?php
asort($eventDateArray);
$todayDate = date('F-j-Y');
$todayDate = strtotime($todayDate);
?>
<?php foreach ($eventDateArray as $k => $v) { ?>
<?php if ($eventDateArray[$k] >= ($todayDate - 100000)) { ?>
<?php $temp = $todayDate - $eventDateArray[$k]; ?>
<?php if ($temp <= 1000000) { ?>
<?php $sortedDateArray[] = $temp; ?>
<?php $sortedPID[] = $eventPIDArray[$k]; ?>
<?php } ?>
<?php } ?>
<?php } ?>
<?php $showPostsCount = 0;?>
<?php if (count($sortedDateArray) > 0) { ?>
<?php foreach($sortedDateArray as $k => $v) { ?>
<?php if ($showPostsCount < 3) { ?>
<li>
<em><?php the_field('start-date', $sortedPID[$k]); ?></em>
<strong><a href="<?php echo get_permalink($sortedPID[$k]); ?>" rel="bookmark"><?php echo get_the_title($sortedPID[$k]); ?></a></strong>
</li>
<?php $showPostsCount++; ?>
<?php } ?>
<?php } ?>
<?php } else { ?>
<li>
<em>No Events Scheduled</em>
<strong><?php _e("Check back soon for upcoming events."); ?></strong>
</li>
<?php } ?>
<?php else : ?>
<li>
<em>No Events Scheduled</em>
<strong><?php _e("Check back soon for upcoming events."); ?></strong>
</li>
<?php endif; ?>
</ul>
I was thinking it has to do with the following lines in the script above but not entirely sure?
PHP:
<?php if ($eventDateArray[$k] >= ($todayDate - 100000)) { ?>
<?php $temp = $todayDate - $eventDateArray[$k]; ?>
<?php if ($temp <= 1000000) { ?>
Would appreciate some help with this if possible. Thanks!