I'm using the following code to display a list of properties on multiple pages. I would like to give users the option of sorting the results by custom fields (perhaps city, or property name, or price). I've tried add_query_arg without success. Does anyone have any suggestions? I would truly appreciate a code example as I'm fairly new to PHP. Thank you so much.
<?php $wp_query = new WP_Query(array( 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'listing_status', 'value' => array('Active', 'In Contract'), ), array( 'key' => 'listing_type', 'value' => 'For Lease' ) ), 'paged' => $paged, 'orderby' => 'title', 'order' => 'ASC' )); $paged = (get_query_var('paged')) ? get_query_var('paged') : -1; ?>