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, 2 months ago by Anonymous.
-
Anonymous(Private) August 12, 2016 at 10:03 am #54389
Thanks for your honesty!
It would be great if this could work just out of the box.I think ACF is amazing and if you support such things, it will definitely be a big plus!
Otherwise I could build my own little things and work with GET variables to set up a simple database search but I love to have the option for later to do more complex searches once our database has more users. I trust your plugin can be a big helper in the future.For now I will fix it by applying a jQuery function that replaces underscores with a space and turns every lower case letter at the beginning of a word into a capital letter.
Trevor(Private) August 12, 2016 at 10:29 am #54398I 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. -
AuthorPosts