- This topic has 3 replies, 2 voices, and was last updated 8 years, 7 months ago by
Trevor.
-
Trevor(Private) March 24, 2017 at 1:18 pm #99243
Hi
It is not a simple thing to do (I think for our next major version, V3, we will make it so), but it is possible, with some coding. You can get the count (xxx results found) and also what fields are set to filter and with what terms, using PHP.
In the WordPress Codex you can find the count code:
https://codex.wordpress.org/Plugin_API/Filter_Reference/found_posts
So that should give you what you the count. In a standard WordPress query, the query array is $wp_query, but your theme may have a customised version, but it should have the
found_postsvariable still.… and to the search terms …
If you take a look at this part of our documentation, our developer, Ross, has added some examples that you could use to get the search terms in the fields/taxonomies.
I think you should be able to use these examples to make your own code? The last example may be especially helpful.
Trevor(Private) March 24, 2017 at 5:54 pm #99296If one field has one term, it comes back as a string. If it has multiple terms, it is an array, so you would need to detect first if it is an array or not, and then treat it accordingly. As an array you would need to step through the array to output the values one at a time using a loop.
Can I close this thread?
-
AuthorPosts