Support Forums

Hey there, it looks like you've been redirected from designsandcode.com - as you can see we have a new home - read more

Looking for support? You can access the support system via your account.

Forums Forums General Display the request on result

Viewing 4 posts - 1 through 4 (of 4 total)
  • Leandro Andrade
    #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 Moderator
    #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_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.

    https://www.designsandcode.com/documentation/search-filter-pro/accessing-search-data/#Get_labelsfor_Multiple_Fields_by_Field_Name

    I think you should be able to use these examples to make your own code? The last example may be especially helpful.

    Leandro Andrade
    #99278

    Thank for replying so fast.

    Ok it worked. I didnt manage to make it display all locations if I dont select any but it display if I select one option.

    It will work for now.

    Thank you again 🙂

    Trevor Moderator
    #99296

    If 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?

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Display the request on result’ is closed to new replies.