In this example:

Ajax Load More will display upcoming events by custom field (date) value – expired or 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 a custom events post type.

Ajax Load More will query for the event_date and 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="2" button_label="More Events" no_results_text="<p>There are no upcoming events.</p>"]

    Variables are being passed into this Ajax Load More shortcode using the do_shortcode method.

    The following Repeater Template was used to create the Event Listing example.