In this example:
Ajax Load More will order past events by custom field (date) value – upcoming events will be dropped from the listing.

The following example uses Advanced Custom Fields to create an event date custom field (event_date) for an events post type.

Ajax Load More will run a query for the event_date custom field and only display results where the value is less than today’s date.

    The following shortcode was used to create the Past Events example.

    <?php $date = date("Y-m-d"); ?> [ajax_load_more post_type="events" meta_key="event_date" meta_value="'.$date.'" meta_compare="lessthanmeta_type="DATE" order="DESC" orderby="meta_value_num" posts_per_page="3" button_label="More Events"]

    Variables are being passed into this Ajax Load More shortcode and therefore it must be added to a page using the do_shortcode method.

    The following Repeater Template was used to create the Past Events example.