DocumentationOnline documentation for Ajax Load More
Order by Meta Key with Meta Query
The code below uses the alm_query_args filter to order results by custom field meta key while querying for a separate custom field using a Meta Query.
functions.php
<?php
function my_city_listing( $args, $id ){
// [ajax_load_more id="city_listing"]
$args['meta_key'] = 'province';
$args['orderby'] = 'meta_value_num';
$args['meta_query'] = array(
array(
'key' => 'city',
'value' => 'Toronto',
'compare' => 'IN'
)
);
return $args;
}
add_filter( 'alm_query_args_city_listing', 'my_city_listing', 10, 2 );
JavaScript