My event php page prints all events saved. I would like to change this and only print events starting later than the current date.
I suppose I need to get the current date and compare the date in my event with the current date.
My code looks like this so far:
<?php
$filters = NULL;
$order = array('date' => 'desc');
$eventNodes = get_nodes('event', LANGUAGE, $filters, $order);
foreach ($eventNodes as $eventNode) :
?>
<li>
<a href="<?php print_full_path('url', FALSE, $eventNode); ?>">
<div class="photo">
<div class="inner"></div>
<img src="images/partner_placeholder.gif" class="placeholder" alt="" />
<img alt="" src="uploads/<?php print_node_field('overview-image', FALSE, 0, $eventNode); ?>" class="img">
</div>
<h4><?php print_node_field('title', FALSE, 0, $eventNode, 60); ?></h4>
<h5 style="margin: -8px 0 0px;">
<?php
$date = print_node_field('date', TRUE, 0, $eventNode);
if (!empty($date)) {
print date('d/m/Y', strtotime($date));
}
?>
<?php
$date = print_node_field('date-until', TRUE, 0, $eventNode);
if (!empty($date)) {
print " - " . date('d/m/Y', strtotime($date));
}
?>
</h5>
<p><?php print_node_field('location', FALSE, 0, $eventNode); ?></p>
<span class="btn">Read more</span>
</a>
</li>
<?php endforeach; ?>
Any ideas on how to do this in a simple way using the foreach loop?
Thanks in advance!