Forums Forums Search & Filter Pro Pre-populate search box with keyword from querystring

  • This topic has 6 replies, 2 voices, and was last updated 6 years ago by Anonymous.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Anonymous
    #236167

    I have a link on my website that opens a Resources page and that page displays all WordPress posts on the website. The Resources page can be filtered using a keyword search box (and your awesome plugin). I’d like to be able to include a querystring variable at the end of the link URL. When the link is clicked, it should do the following:

    (1) Open Resources page
    (2) Pre-populate search box with the keyword value included in the link’s querystring
    (3) Load Resources page filtered by the keyword from Step (2)

    The three steps must happen in unison, so to the user’s perspective, they’ve opened a resources page that shows all posts for a specific topic or tag (and NOT all posts for all topics).

    Trevor
    #236183

    Are you able to send me a live link/URL to your initial search page, also that for the resources page, plus a suggested keyword to test with, so I can take a look?

    Please note that we are closed for the day as it is late here in the UK (gone 7PM). I will get on this tomorrow.

    Anonymous
    #236264

    The link exist on our home page (https://bioplusrx.com), for an image called COVID-19 Updates. When clicked, we would prefer it to take the user to our resources page (https://bioplusrx.com/resources/).

    You will notice that at the top of the page we have a search box. We would like this page to load with the keyword “COVID-19” preloaded in the search box, so that in essence, the user would be looking at a filtered posts page that shows only posts related to COVID-19.

    At the moment, the link takes the user directly to a single COVID-19 post, but we’d like them to see all our our posts related to the topic.

    Trevor
    #236270

    Ah. You would need to add a WordPress rewrite in to your child theme functions.php to change the URL when it finds that exact match.

    My guess is that the url would have to be changed to end with /?_sf_s=covid-19

    Anonymous
    #236272

    I will do some testing and report back. Thanks for the prompt reply!

    Trevor
    #236274

    There are some code snippets for rewrites in posts in this forum, for example:

    https://support.searchandfilter.com/forums/topic/integrate-with-theme-search/#post-207270

    Anonymous
    #236278

    Thanks!

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