- This topic has 3 replies, 2 voices, and was last updated 7 years, 8 months ago by Trevor.
-
Anonymous(Private) March 24, 2017 at 12:58 pm #99227
How can I display what was select in the title of the results?
For example if I select category: finance and location: dublin, they will display on the top of the results
Or if I dont select location it would show Finance all location before the results.
my site so far:
http://www.bepitched.juvoclients.com/category/Trevor(Private) March 24, 2017 at 1:18 pm #99243Hi
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_posts
variable 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