Forums › Forums › Search & Filter Pro › ACF data not being fetched and displayed in results
Tagged: acf, advanced custom fields
- This topic has 11 replies, 2 voices, and was last updated 6 years, 3 months ago by Anonymous.
-
Trevor(Private) August 20, 2018 at 12:31 pm #185960
Ah. So, you are using the shortcode results method, and you want to display ACF data. The guide to customising the appearance of the results is here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
You will need to do that first and then use the ACF documentation to add your own HTML/PHP to output as you want. This search will give you some snippets already posted on our forum:
https://support.searchandfilter.com/forums/search/results.php+acf+get_field/
For example, this post (and thread):
Trevor(Private) August 20, 2018 at 3:23 pm #185985Yes. You need to add a Post Meta field to the Form UI, then choose the type of field (Date, Number, Choice) and then select the meta key (not the TRUE ACF fiedl does NOT normally start with an underscore).
Outputting an ACF (or any custom) field is not normally part of any theme’s standard templates, so customisation is almost always needed.
Anonymous(Private) August 20, 2018 at 3:35 pm #185991Sorry – you have lost me.
I want to get the search and filter plugin to search through the ACF fields I am using on the site. How can I set up the search function so it does this – I understand I need to edit the results.php code to add in relevant placeholders to fetch back the ACF fields there – but how can I specify / make sure that the search function is looking through the ACF fields?
Trevor(Private) August 20, 2018 at 3:40 pm #185995Ah, you want to perform a textual entry search. The Search & Filter Pro Text Search field uses the standard WordPress search, so looks only in the Post Title and Content. To help you control this better, on the form’s Advanced settings tab you will see 2 settings for Relevanssi.
The documentation for this is here:
https://www.designsandcode.com/documentation/search-filter-pro/3rd-party/relevanssi/
You would need to install and activate the free Relevanssi plugin as well.
Then set it up and build its index (make sure it is indexing the desired post types AND the taxonomies/custom fields that you want to search).
A simpler alternative is to use WP Extended Search (which requires no options to be set in our plugin).
-
AuthorPosts