Custom Upcoming Event Loop [PHP]
-
I have an event loop I’ve created that isn’t functioning properly.
I’m using the plugin wp-types (www.wp-types.com) to create custom post types and fields. I’ve used it to create a custom post type called ‘events’.
My loop looks something like this –
<!-- LOOP START --> <?php //WP_Query Arguments $args = array ( 'post_type' => 'event', 'posts_per_page' => '4', 'meta_key' => 'wpcf-event-start-date', 'meta_value' => date('Ymd'), 'meta_compare' => '>=', 'orderby' => 'meta_value_num', 'order' => 'ASC', ); ?> <?php $the_query = new WP_Query( $args ); ?> <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?> <div class="col-md-2"> <?php $date= get_field('wpcf-event-start-date'); ?> <a href="<?php the_permalink() ?>"><?php the_post_thumbnail( 'medium' );?><div class="overlay"></div></a> <div class="event-info"> <h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3> <p class="date"><?php echo date('l, F jS, Y', strtotime($date)); ?></p> <!--<?php the_excerpt(); ?>--> </div> </div><!-- /.col-md-2 --> <?php endwhile;?> <!-- LOOP FINISH -->
I’m assuming the reason that nothing is displaying is due to the meta_key/meta_value property(ies). The plugin exports the DATE field as the following:
It requests and input format of – Month dd, yyyy + 24 hour time.
It returns – 1403388000 – for June 21, 2014 22:00
I think my loop is not properly translating the value returned. Any help is greatly appreciated. Thanks!
- The topic ‘Custom Upcoming Event Loop [PHP]’ is closed to new replies.