Forums Forums Search & Filter Pro Customize search results

Viewing 10 posts - 1 through 10 (of 10 total)
  • Anonymous
    #94243

    Hello.
    I created a custom page where i want to display search results.
    The page is: https://www.memoriecondivise.it/risultati-ricerca/
    You can see search results by the search form on our home page https://www.memoriecondivise.it

    How can we customize search results? We also want that the search terms appear on the page’s header like a real wp search. And we want that if there are no search results, the page will display a not found search error.

    Example

    Trevor
    #94306

    The appearance of the search results, generated from our plugin’s form (which is using the ‘As an Archive’ Display Results method), are determined the template of your theme for that page. At this time, the search parameters cannot be detailed except by custom coding with PHP, by extracting data from the sf_query array. You can see an example in this thread. This is a feature we hope to introduce in the next major version (V3), which is some months away yet (but already in progress).

    Similarly, the ‘No results found message’ comes from your theme templates.

    Anonymous
    #95084

    I’ve no problem to insert php code in the file, i follow your suggestion with the example thread but not working.

    Can you send me the right PHP code to insert in search.php file and finally display something like this:

    Search for {Search_Key}. Find {Number_Of_Results} results.

    Thanks

    Anonymous
    #95086

    I can use also a page of my template, in that situation it could be useful for me a shortcode to display:

    Search for {Search_Key}. Find {Number_Of_Results} results.

    Thanks

    Trevor
    #95136

    Hi Marco

    The code required is not easy to figure. You would need to dump the sf_query array (using print_r) inside <pre></pre> tags and then figure which element(s) you want. This will be variable because the user may search different fields. Then the number of results is harder to find. I was unable to work that out last time I tried. I did spend weeks on that last code example I showed, and that is outside the remit of our support, as this feature is not an advertised feature.

    For now I would advise you wait for the next version.

    Anonymous
    #95430

    Ok thanks
    Do you know when the next version will go aut?

    Thank You very much

    Trevor
    #95498

    As I said in this post, it is a few months away. As with all coding projects, it is hard to put dates on completion.

    Trevor
    #95823

    Hi

    Thinking about this some more. In the WordPress Codex:

    https://codex.wordpress.org/Plugin_API/Filter_Reference/found_posts

    So that should give you what you the count that you want, yes? 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.

    If you take a look at this part of our documentation, 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 especially (for you).

    Anonymous
    #101327

    Hi kind Trevor

    You said me on 7 March: For now I would advise you wait for the next version.

    Now I upload last version (2.3.3).

    Do you know if there is some news about this topic (to show something like this in Result Page: Search for {Search_Key}. Find {Number_Of_Results} results)?
    Thanx for your help.

    Trevor
    #101332

    Ah. My reply on 7 March was was not specific enough. 2.3.x (where x is simply bug fixes) will be followed by V3.0.x in a few months. As I clarified in my post on March 8 above, it will be some months away yet.

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