Forums › Forums › Search & Filter Pro › Issue with get_fields_html
- This topic has 6 replies, 2 voices, and was last updated 7 years, 3 months ago by
Anonymous.
-
Trevor(Private) March 30, 2018 at 11:35 am #169154
Are you trying to get terms from the results array? This search shows other user posts that fetch data from the array:
https://support.searchandfilter.com/forums/search/sf_current_query+active_terms/
Anonymous(Private) March 30, 2018 at 3:57 pm #169216No, I’m trying to get the post_type from $sf_current_query->get_fields_html(array(“_sf_s”, “_sft_access_level”, “post_type”,”_sft_topic”));
You can see it in the image under form_fields/post_type/post_types
Why are they not formatted in $sf_current_query->get_fields_html(array(“_sf_s”, “_sft_access_level”, “post_type”,”_sft_topic”)); as in the other array entries?
Anonymous(Private) March 30, 2018 at 4:28 pm #169225I’ve done that already, if you look at the bottom code in the original post.
So what you’re saying is that you can’t access it via $sf_current_query->get_fields_html(array(“_sf_s”, “_sft_access_level”, “post_type”,”_sft_topic”)); despite “post_type” being in there?
There’s not a lot of documentation on it so it’s difficult to know exactly what is to be expected here.
The https://www.designsandcode.com/documentation/search-filter-pro/accessing-search-data/ page just has examples but doesn’t explain much.Anonymous(Private) March 30, 2018 at 11:40 pm #169289Ok, so I was right to use get_array() in the first place (excuse the long winded method, it was for debugging purposes).
The documentation is lacking a little in this regard, so I suggest you clarify the use and differences between get_array() and get_fields_html. The expectation is that if it’s in form_fields you should be able to extract it via get_fields_html into an output string, whereas in you actually need to use get_array() and format the output yourself. In this case we also need to replace a name as well.
ty.
-
AuthorPosts