Register taxonomy to use in search
-
Hi, I’m trying to register taxonomies created with toolset types with both custom profile fields, which I’ve done, and then with your profile search. I’ve seen the below, can I just confirm the use?
https://dontdream.it/bp-profile-search/custom-profile-field-types/
For instance, if I have the taxonomy ‘House Features’ with terms ‘Garden’, ‘Shed’ and ‘Terrace’ what would this code look like:
add_action ('bps_custom_field', 'my_hook02'); function my_hook02 ($f) { if ($f->type != 'my_custom_type') return; // submit the format of my_custom_type $f->format = 'text'; // submit the field options, if they are not stored in // the standard (wp_)bp_xprofile_fields table $f->options = array (0 => 'Male', 1 => 'Female'); // submit the search function, if the field values are not // stored in the standard (wp_)bp_xprofile_data table $f->search = 'my_search_function'; } function my_search_function ($f) { $filter = $f->filter; // the current search mode $value = $f->value; // the value(s) POSTed by the search form $results = ... // array of matching user IDs return $results; }
And can I also check, would the results be that in the search form, once it’s registered, the user checks which terms they would like to search for under that taxonomy, and users who have checked those terms as applying, will appear?
Thank you
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘Register taxonomy to use in search’ is closed to new replies.