rem_lists_sorting_options
This filter returns the array of options to sort property listings from top bar.
Arguments
- Options [Array]
Example
The following code will add another option with the name Sort By ID in the sorting dropdown menu and will sort in descending order. Paste the following code inside the functions.php file of your theme/child theme.
add_filter( 'rem_lists_sorting_options', 'rem_sort_by_id', 10, 1 ); function rem_sort_by_id($options){ $id_op = array( 'title' => __( 'Sort By ID - DESC', 'real-estate-manager' ), 'value' => 'ID-desc', ); $options[] = $id_op; return $options; }
Please note that in value key you have to provide 2 values separated with a dash “-“.
{field_name}-{asc or desc}
Custom Property Fields
If you want to sort by custom property fields, you have to provide value in the following format.
rem_{field_name}-{asc or desc}-{custom}
for ascending property_area, it will become
rem_property_area-asc-custom
When you will paste the following code inside functions.php file of your theme/child theme, it will display 2 more sorting options in the top bar
- Sort By Beds – High to Low
- Sort By Beds – Low to Hight
add_filter( 'rem_lists_sorting_options', 'rem_sort_by_beds', 10, 1 ); function rem_sort_by_beds($options){ $beds_desc = array( 'title' => __( 'Sort By Beds - High to Low', 'real-estate-manager' ), 'value' => 'rem_property_bedrooms-desc-custom', ); $beds_asc = array( 'title' => __( 'Sort By Beds - Low to Hight', 'real-estate-manager' ), 'value' => 'rem_property_bedrooms-asc-custom', ); $options[] = $beds_desc; $options[] = $beds_asc; return $options; }