Searching Exterior Sites from WordPress Search Box
-
I am looking at how to search multiple exterior sites from within WordPress. I essentially want to redirect the search to different locations, based on the selection made in a drop down menu. If the user selects “website” it would search the WordPress blog. If the user selects “site1”, it would take the input and pass the user along to https://www.site1.com.
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, using:
<?php header("Location: https://www.site1.com/?query=term"); ?>
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, site 2, and so on.
Digging around online and in the WordPress forum, I have found similar questions. It sounds like a common feature users are looking for.
I’d be grateful for any assistance with this feature.
Thanks.
- The topic ‘Searching Exterior Sites from WordPress Search Box’ is closed to new replies.