<?php
// event posts settings
global $post;
$i = 1;
$currentdate = date('Y-m-d');
$eventsloop = new WP_Query( array(
'post_type' => 'makemycalendar',
'orderby' => 'meta_value',
'meta_key' => 'makemycalendar_startdate',
'order' => 'ASC',
'event-categories' => $category,
'posts_per_page' => 9999
) );
global $wp_query;
$eventsloop->in_the_loop = true;
// event posts loop
while ( $eventsloop->have_posts() ) : $eventsloop->the_post();
$startdate = get_post_meta( $post->ID, "makemycalendar_startdate", $single = true );
$startstring = strtotime($startdate);
$starttext = date('M j, Y', $startstring);
if ( $startdate >= $currentdate && $i <= $quantity ) { ?>
<div <?php post_class(); ?>>
<div class="mmc-event-thumbnail">
<?php if ( has_post_thumbnail() ): ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(); ?></a>
<?php endif; ?>
</div><!-- .mmc-event-thumbnail -->
<h4><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h4>
<em><?php echo $starttext; ?></em>
<?php the_excerpt(); ?>
<div class="clear"></div>
</div><!-- .post -->
<?php $i++; ?>
<?php } //end startdate and quantity conditional ?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>