In this example:
Ajax Load More will query by custom field value to display a list of upcoming events – expired/past events will be dropped from the listing.

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

We then created an Ajax Load More shortcode that queries the event_date custom field and only displays results where event_date is greater than today’s date.


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

    <?php $date = date("Y-m-d"); ?> [ajax_load_more repeater="template_23" 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.