Two questions here:
1) I’d like to add a second search source to the search box available as a radio toggle (or some other selection means. Basically I want users to be able to use the default search you provide, or select a radio button to search an alternate source (listed in the form action) which is passed as a get via the terms entered. Ideally this would provide for adding a third source as well, so users just select the source of the search, enter their terms, and click the search icon to be routed to the appropriate results page. Is this possible and how?
2) Searchform.php includes this comment:
// allows to add aditional form fields to modify the query (eg add an input with name "post_type" and value "page" to search for pages only)
How, specifically would this be implemented at a code level for pages and posts respectively?
You can use the avia_frontend_search_form hook to add your custom form fields (eg with a child theme function, etc.) without modifying the searchform.php file itself. I.e. use the hook to call a function like:
echo '<input type="hidden" id="post_type" name="post_type" value="my_post_type" />';
- this function would add a hidden field to the search form which limits the search to the “my_post_type” post type.
The topic ‘Search Sources and Search Facets’ is closed to new replies.