In this example:
Ajax Load More will order upcoming events by custom field (date) value Рexpired/past 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 query for the event_date custom field and only display results where the value is greater than or equal today’s date – check out the Past Events example.


    The following shortcode was used to create the Event Listing example.

    <?php $date = date("Y-m-d"); ?> [ajax_load_more post_type="events" meta_key="event_date" meta_value="'.$date.'" meta_compare=">=" meta_type="DATE" order="ASC" 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 Event Listing example.