Forums › Forums › Search & Filter Pro › Using add_filter with Combobox?
Tagged: add_filter, combobox
- This topic has 6 replies, 2 voices, and was last updated 4 years, 8 months ago by Anonymous.
Viewing 7 posts - 1 through 7 (of 7 total)
-
Anonymous(Private) February 25, 2020 at 8:17 pm #234883
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.
-
AuthorPosts
Viewing 7 posts - 1 through 7 (of 7 total)