That’s a great question, time indeed that I update the documentation!
I just added another example in the wiki (see the 3rd example on that page):
https://github.com/ms-studio/minimalistic-event-manager/wiki/How-to-query-for-events
Here is the code for that query:
<?php
// We define the current date, using the included function.
$mem_today = mem_date_of_today();
// We set a limit for past events:
$mem_date_expiration = ( 2 * DAY_IN_SECONDS );
// Here we will display them up to 2 days after they occurred.
// Change that number according to your requirements.
$mem_unix_limit = ( $mem_today["unix"] - $mem_date_expiration );
$mem_age_limit = date_i18n( "Y-m-d", $mem_unix_limit);
// Now, the custom query:
$args = array(
'posts_per_page' => 5,
'meta_key' => '_mem_start_date',
'meta_value' => $mem_age_limit,
'meta_compare' => '>=',
'orderby' => 'meta_value',
'order' => 'ASC',
'ignore_sticky_posts' => true
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
?>
<h1>Current Events</h1>
<?php
while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<h2 <?php post_class() ?> >
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
</h2>
<?php
// Display the date, using the ready-made function.
$mem_event_date = mem_date_processing(
get_post_meta(get_the_ID(), '_mem_start_date', true) ,
get_post_meta(get_the_ID(), '_mem_end_date', true)
);
?>
<span class="post-date">
Date: <?php echo $mem_event_date["date-num"]; ?>
</span>
<div class="post-excerpt">
<?php the_excerpt(); ?>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php _e( 'No upcoming events.' ); ?></p>
<?php endif; ?>
Let me know if something is not clear.