Forums › Forums › Search & Filter Pro › Using ACF select field for dropdown (label/value issue)
Tagged: acf, ACF select field, advanced custom fields, dropdown options, labels, meta Fields, meta value, options select, select field values, select value
- This topic has 72 replies, 5 voices, and was last updated 8 years, 1 month ago by Anonymous.
-
Anonymous(Private) September 19, 2016 at 2:41 pm #58799
Hey Jeremie,
the script I wrote will most likely need some modifications before this can work for you.
If you could send me a link to your page (where you have your search form) I may be able to assist a bit if you need help and if it does not get too complicated. 😉I hope the guys from Designs & Code can provide a solution soon, so we can just use the plugin with ACF custom fields (values and labels).
Warm regards,
SebastianAnonymous(Private) September 19, 2016 at 2:44 pm #58803Hi Sebastian
Thanks a lot , this is the public page : http://ife.siter.fr/canevas/chercher/
first list is aclassical taxonomy, but useless because only for standard post
second list is the goood one, without the label, only numeric value
third list is an other list, same problemdoes it help ?
best regards
JeremieAnonymous(Private) September 19, 2016 at 3:34 pm #58817Hi Jeremie,
I think the issue you are having is a bit different from mine.
A short explanation may help:
I am working with a custom field select field which basically has values and labels that are very similar just that the label for example shows “United States” where the value shows “united_states”. Because I can’t get the plugin to show the label “United States” in the front end of my site, I am running that script you saw to replace all underscores with a space and make all words begin with a capital letter. That way my drop down list shows the right country names instead of the label values.It seems that you can’t do the same thing in your case but maybe I misunderstand what you are trying to do. For sure you can’t get any jQuery/Javascript to show you the labels of your field from the database, at least not without jason or ajax code. So I assume my script won’t work for you and a solution could be very complicated to implement if it is not coming from the search and filter plugin.
My script basically only changes the text that is already there, so it does not bring the labels from the database, it is only cosmetic.
No
Anonymous(Private) September 19, 2016 at 4:23 pm #58831Jeremie,
I think in your case you could jQuery to replace/update the value of each option tag with a new value after the page is loaded. So when you know the desired value you could replace “field_57dfa59c4a32a (1)” with another text but you would have to do that for every possible value that shows up in your select field. If you know all the values, it is just some work to create the list and implement it into some jQuery code.
The jQuery for that will have to look different from what I posted earlier.
Trevor(Private) September 19, 2016 at 4:27 pm #58833I think that the issue may be that the field type in ACF that is being used is a complex one, whereas, right now (but we hope to support most of the complex ones very soon), we support only the basic ACF fields. I think this post looks at this issue:
https://support.searchandfilter.com/forums/topic/filter-dropdown-options/#post-34366
Ross Moderator(Private) September 20, 2016 at 1:12 pm #59004Hi all
The problem is you are using ACF “relationship” field types. We’ve never officially supported them although the link Trevor provides does have a solution.
Saying that, I’ve been working the past week on getting this integrated and am happy to say the current relationship field types will be supported. Finishing off testing now and will send both of you a copy of the dev version this evening.
Thanks
-
AuthorPosts