on a custom wordpress theme I am developing for a client (http://garethstewart.co.uk) I have a list of Events which are a custom post type. I want to be able to order them chronologically. Here is the code I have to render out the dates:
<?php $args = array( 'post_type' => 'event', 'posts_per_page' => 9 );$loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php $event_date = get_field('date'); // Get the event's date ?>
<?php $today = date('F j, Y'); // Get today's date ?>
<?php if ($event_date >= $today) : ?>
<div class="text-center">
<div class="feature">
<i class="icon inline-block mb30 fade-0-4 fa fa-calendar-o" style="font-size: 38px !important;"></i>
<h4 class="uppercase bold"><?php the_field('date'); ?></h4>
<h5><?php the_field('description'); ?></h5>
</div>
</div>
<?php endif; ?>
Any help is really appreciated.
Thanks, Jamie