DocumentationOnline documentation for Ajax Load More
Date Comparison
The code below will query an event post type by comparing the start and end custom field dates.
<?php
$start_date = get_field( 'start_date' );
$end_date = get_field( 'end_date' );
echo do_shortcode( '[ajax_load_more
post_type="event"
meta_key="start_date:end_date"
meta_value="' . $start_date . ':' . $end_date . '"
meta_compare=">=:lessthan"
meta_type="DATETIME:DATETIME"
meta_relation="AND"
]' );
PHPNote: We are using lessthan in the meta_compare parameter as using a < symbol inside shortcode can cause issues with rendering. This is an undocumented ALM hotfix designed to allow for symbols in shortcodes.