Forums Forums Search & Filter Pro Use shortcode and display results on different pages

  • This topic has 4 replies, 5 voices, and was last updated 9 months ago by Anonymous.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Anonymous
    #275141

    We would like to use a one form and results shortcode, and embed it to multiple different pages. In addition to that, we need the search results display below the form where the search form is added using ajax.

    Currently, when we submit the form, it redirects to a different page but what we need is just to load the results to the same page where the form is added.

    Trevor
    #275178

    You could do that by having a dynamic results URL, using this filter:

    https://searchandfilter.com/documentation/action-filter-reference/#modify-urls

    and get_peramlink() you can get 1 filter to work across multiple pages.

    I do not have any code snippets that do that, unfortunately.

    Anonymous
    #276745

    In case someone else runs into this problem, this works to add the form to multiple pages:

    function my_set_sf_resultsURL( $url, $sfid) {
    $url = get_permalink();
    return $url;

    }
    add_filter( ‘sf_results_url’, ‘my_set_sf_resultsURL’, 10, 2 );

    Ross Moderator
    #276747

    Thanks for sharing Stefan 🙏

    Anonymous
    #288372

    Yes, brilliant thank you.

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