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, 10 months ago by
Anonymous.
-
Trevor(Private) August 12, 2016 at 10:29 am #54398
I do not know if you can edit (permissions).
The link to edit a post looks like this:
https://support.searchandfilter.com/forums/reply/54389/edit/
Anonymous(Private) August 20, 2016 at 8:29 pm #55112Hi Trevor,
just wanted to share my solution here – the temporary fix, until you support the display of label values instead of values from an ACF dropdown fields.
jQuery(document).ready(function(jQuery) { // text replace in the option tags of the select field jQuery("#search-filter-form-702 select").find("option").each(function () { // replace each underscore with a space and turn each first letter of the new words into an uppercase letter jQuery(this).text(jQuery(this).text().replace(/_/g," ").split(" ").map(function(i){ return i[0].toUpperCase() + i.substring(1) }).join(" ")); }); });
I had fun making this, so it was not to bad having to do it. 🙂
I hope this may turn out useful for somebody or even obsolete soon.Anonymous(Private) September 6, 2016 at 4:40 am #56665Hi Omar,
I have figured out a work around based on jQuery. This is not the ideal scenario to have to use this but it works pretty well for me.
jQuery(document).ready(function(jQuery) { // text replace in the option tags of the select field (but not the first one ( slice(1) ) jQuery("#search-filter-form-702 select").find("option").slice(1).each(function () { // replace each underscore with a space and turn each first letter of the new words into an uppercase letter jQuery(this).text(jQuery(this).text().replace(/_/g," ").split(" ").map(function(i){ return i[0].toUpperCase() + i.substring(1) }).join(" ")); }); });
Warm regards,
SebastianAnonymous(Private) September 6, 2016 at 2:50 pm #56719Hi Sebastian,
Thank you. I saw your previous post and i tried you fix but it did not work for me. HonestlyI would rather wait for an official fix especially since this is the functionality I paid for. Thanks for the assistance anyway. I will wait to see if Trevor and his team and create a fix and update ether plugin accodingly.Ross Moderator(Private) September 7, 2016 at 10:16 am #56772Hey Omar, just to confirm are you using ACF or ACF Pro?
-
AuthorPosts