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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<?php function my_city_listing( $args, $id ){ // ALM Shortcode // [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); |