DocumentationOnline documentation for Ajax Load More
Date Query
Ajax Load More does not integrate directly with the WP_Date_Query class, however we can use the alm_query_args filter to extend the Ajax Load More query to include a custom date query.
The code sample below will query posts between March 1, 2020 and January 1, 2019 using a WP_Date_Query.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
// [ajax_load_more id="date_query_example"] function my_alm_date_query_example($args, $id){ $args['date_query'] = array( 'relation' => 'AND', array( 'before' => array( 'year' => 2020, 'month' => 3, 'day' => 1 ), ), array( 'before' => array( 'year' => 2019, 'month' => 1, 'day' => 1 ), ) ); return $args; } add_filter( 'alm_query_args_date_query_example', 'my_alm_date_query_example', 10, 2); |