Last active
May 30, 2016 13:38
-
-
Save dcooney/357246e89c9e1b8ed4dc3bf395c07406 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="shows-list-wrap"> | |
<?php | |
$currentdate = date('Ymd'); | |
$args = array( | |
'posts_per_page' => -1, | |
'post_type' => 'concert_type', | |
'order' => 'asc', | |
'orderby' => 'meta_value_num', | |
'meta_query' => array( | |
array( | |
'key' => 'concert_date', | |
'value' => $currentdate, | |
'compare' => '>=', | |
), | |
), | |
); | |
$cpt_query = new WP_Query($args); | |
?> | |
<?php if ($cpt_query->have_posts()) : while ($cpt_query->have_posts()) : $cpt_query->the_post(); ?> | |
<?php | |
global $post; | |
$date = get_field( 'concert_date' , $post->ID, false); | |
// make date object | |
$date = new DateTime($date); | |
?> | |
<div class="shows-list"> | |
<?php the_title(); ?> <span>- <?php echo $date->format( 'n/d' ); ?></span> | |
</div> <!-- /shows-list --> | |
<?php endwhile; endif; // end of CPT loop ?> | |
<?php wp_reset_postdata(); ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment