Forums › Forums › Search & Filter Pro › Pods Relationship Fields
Tagged: custom fields, pods, post meta
- This topic has 5 replies, 5 voices, and was last updated 4 years, 1 month ago by Anonymous.
-
Anonymous(Private) May 12, 2020 at 4:17 pm #243589
Hi guys,
I did a search on this and noticed the question asked a few times before, with the general advice being ‘we don’t support that yet but we’re hoping to include this in V3.’ BUT I thought I would ask it again, in case you a) have an updated timeline and/or b) have any suggestions for a manual (e.g. PHP & Jquery) solution!
In short – we have two post types with a relationship field, using Pods. We are not in a position to switch to ACF on this post type as it doesn’t do some other stuff we need (Pods relationship fields really are better). We would like to have a dropdown with the labels, but it only shows the ID’s. Both post types are constantly being updated so a static list isn’t viable. Any options?
Ross Moderator(Private) May 13, 2020 at 9:24 am #243695Hi Jo
This is actually possible using one of our filters – are you comfortable tweaking a little PHP to put in your themes
functions.php
file?Thanks
Ross Moderator(Private) September 25, 2020 at 10:57 am #260793Hi Sunny
You can replace the ID’s, by post title, by adding this to
functions.php
:function filter_input_object($input_object, $sfid) { if(($input_object['name'] == '_sfm_podsrelationship')) { foreach($input_object['options'] as $option) { $option->label = get_the_title($option->value); } return $input_object; } else { return $input_object; } } add_filter('sf_input_object_pre', 'filter_input_object', 10, 2);
Make sure to change the name of the field to match yours:
_sfm_podsrelationship
To find your field name, just check the URL when you do a search:
https://searchandfilter.com/documentation/accessing-search-data/?sfref=dc#how-to-get-the-field-nameLet me know how you get on.
Thanks
-
AuthorPosts