Hello,
I’m using a combobox to display / filter regions on a real estate website. How can I add a new region to the combobox via my functions.php file? Basically, I want to combine a few towns into a single option.
I’ve used the code below to add options to a normal dropdown in the search but couldn’t get something similar to work for the combobox:
function edit_rent_range($input_object, $sfid) {
if(($input_object['name']!='_sfm_rent_max')||($input_object['type']!='select'))
{
return $input_object;
}
if(!isset($input_object['options']))
{
return $input_object;
}
//create a new option we want to add
$new_last_option = new StdClass();
$new_last_option->value = "3000000";
$new_last_option->label = "$35,000+";
//add a brand new option to the bottom
array_push($input_object['options'], $new_last_option);
return $input_object;
}
add_filter('sf_input_object_pre', 'edit_rent_range', 10, 2);
Any help will be appreciated.