Support Forums

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

Forums Forums Search & Filter Pro Single search form with multiple “result” containers

Viewing 7 posts - 1 through 7 (of 7 total)
  • Kevin Williams
    #273430

    Hello,

    I’m curious to know if there is a way to have two “results” containers? So imagine two sort codes in divs (children) sitting beside each other with one parent search form. I will attempt to explain further. Two separate post types (Bio and Location) with identical tags, if a user were to select the location tag dropdown of “City X” both “Bio” and “Location” post types would update in their individual containers. Is that possible?

    Any response is welcome, my thanks in advance.

    Trevor Moderator
    #273438

    This will change with V3 (due in a month or two), but, for now, when referring to the results page, having a cloned/duplicated form (having more than one instance of the same form), or multiple different forms, will potentially be an issue, as doing this can mean that they don’t work together and often will conflict with each other. Just be aware that this is possible (likely), so if you have problems with the results not working, that might be why. Normally, we suggest only one form instance on the results page.

    You CAN have more than one form on any page other than the results page.

    Similarly, one form can control only set of results on a page if using Ajax. If Ajax is OFF, one form can, if set to custom display results method, control two sets of results, provided you code the template for the page in such a way as the wp_query for each results loop has its own arguments and has an argument for our filter, as per the instructions on this page:

    https://searchandfilter.com/documentation/search-results/custom/

    You could use an argument like

    'search_filter_id' => 123,

    Markus Verwey
    #276228

    Hi,

    I need this specific functionality for my project – one form updating 2 result sets on the same page (2 types of posts with the same taxonomies). Can you let me know if there is any developer/beta version 3 of the plugin available that I can get my hands on? Thanks in advance.

    Trevor Moderator
    #276230

    I am sorry, the V3 Pro edition project is delayed with an anticipated release now in Autumn 2021.

    Quagga
    #276234

    Hi

    passing by and reading you, a hack come to my mind.

    you can create a custom result template.

    You can set an ID to an html container that containt the whole loop

    In the loop, you get each result item… You can set an html container that contain each item…
    As you are in the loop, you can get the post type of each item, and the taxonomy terms of each item…
    Thus you can programatically set a css class to the item html container base on the item CPT or terms ;

    Ok then come my hack
    The above done, duplicate in your template the whole loop container… I don’t think this should be an issue
    at this stage, the result template will display the result twice…
    now add css class with the proper selector to selectively display/hide the iten in each loop container.

    for instance

    myLoopContainer1 .myCpt1,
    myLoopContainer2 .myCpt2, {
    display : block ;
    }

    myLoopContainer1 .myCpt2,
    myLoopContainer2 .myCpt1, {
    display : hidden;
    }

    Tadaa..

    Quagga
    #276236

    Oups, forgot to mention that you need to change the ID of the duplicated loop container…

    and of courses you CSS selectors need to use “#” to select the div’s ID like this

    #myLoopContainer1 .myCpt1,
    #myLoopContainer2 .myCpt2, {
    display : block ;
    }

    #myLoopContainer1 .myCpt2,
    #myLoopContainer2 .myCpt1, {
    display : hidden;
    }

    Markus Verwey
    #276246

    Hey,

    Thanks so much for this brilliant hack. Unfortunately, in our case there will likely be many many posts in each of the 2 categories requiring a pager and if items are simply hidden/displayed with HTML it would lead to unpredictable results (page showing 0 or 1 results with a pager for the next “10 results” below). I think I will need to roll up my sleeves and figure out the wp_query approach but thank you for offering a solution, I hope it can help someone else on the same quest.

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

You must be logged in to reply to this topic.