• I’m looking for a plugin or function that would allow me to create a searchbox with a dropdown so the user can decide between searching on our WordPress site or sending the search to an external site. If you search the external site, it would take you to the search results on that site, we’re not trying to display that site’s results within WordPress. Basically just the WordPress equivalent of this antique: https://www.javascriptkit.com/script/cut130.shtml

    Any help would be much appreciated!

    • This topic was modified 4 years, 6 months ago by Jan Dembowski.
Viewing 2 replies - 1 through 2 (of 2 total)
  • @npanina2006

    You want to pass values from one server to another server ?
    Did you already Altavista for an answer ? ha ha – sorry, couldn’t resist

    I think you could use curl :
    https://curl.haxx.se/docs/
    Other than that, I guess you could pass in a query string, but it would be better/safer to store them in a db table first. There are crappy ways to do this, using directives likes Server.Transfer or some sort of re-direct, but I wouldn’t do it.
    Put it this way, If may boss came to me with this task, I would just straight up say no.

    Better ways are to create an index on your main server. You could do this using Elastic Search, or in my experience I have used Solr to accommplish this. The data lives in another db, so Solr goes and gets the data and builds an index file. I have a cron that runs every 15 minutes to update the index.

    @npanina2006

    Did you find a solution to your search issue?

    I am also looking at how to do this within WordPress. I can easily do it using the following standalone html form:

    <form id="form_id" method="post" name="search" action="search.php">
    <select name="site" id="site">
    <option value="https://my.wordpress_site" selected>Wordpress site</option>
    <option value="https://www.site1.com">site1</option>
    <option value="https://www.site2.com">site2</option>
    </select>
    <input type="text" value="" name="term" id="term" />
    <input type="submit" value="Submit">
    </form>

    I then pass the variables, “site” and “term” onto search.php which combines them and sends them on to the selected site to search, outside of WordPress.

    It works fine on its own. I am now trying to figure out how I could pull it into WordPress, so users could choose between searching the blog, or site 1 or site 2.

    Digging around online and in the WordPress forum, I have found similar questions. It sounds like a common feature users are looking for.

    If you’ve had any luck, I’d be interested in seeing what you did.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Search box with dropdown to search external site’ is closed to new replies.