Forums › Forums › Search & Filter Pro › Search in a header, display on a archive page.
- This topic has 11 replies, 2 voices, and was last updated 5 years, 2 months ago by Trevor.
-
Anonymous(Private) September 13, 2019 at 1:38 pm #220975
Hello,
I would like to know if there is a way to “split” the plugin, I explain:
I created a Search Form UI containing a search field and a post_type field.
I want the search field to be displayed in my header.php (so on every pages, even the result page).
And I want the post_type field to be displayed on my result page (which is an archive page).The goal is to have my header search open in an archive page, and then i can use filters to reduce results on this page.
I tried before to use the default WP search in my header.php, and just use a post_type field to filter on my result page. But it seems like the filter create a new Query and doesn’t work onthe previous search.
How can i proceed/change my code to reach my goal ?
Thanks in advance for the response.
Trevor(Private) September 16, 2019 at 12:53 pm #221068Splitting the form will be become possible in V3 (I have not ETA for this yet).
In the meantime (now with V2.x) It somewhat depends on how you theme is constructed, but, generally, it can be done. There are some options:
#1 The header search can use a WordPress rewrite to divert to a page controlled by a form from our plugin, or
#2 You can recode the theme header PHP template file, or the searchform PHP template file to directly go to a page controlled by a form from our plugin, but this requires that either you are using a totally custom theme, or you should be using a child theme of a premade theme (which you should always do anyway).
#3 Similar to #2, but instead place a WordPress PHP do_shortcode function in the header (or searchform) PHP template file instead of the normal search.Let me know which you think might work best for you, and I can help you with that.
Anonymous(Private) September 16, 2019 at 2:15 pm #221092Hello Trevor,
Both #2 and #3 are interesting. What would be the easier method to set up?
I kinda tried something like #3 but i think my approach was wrong:
Created 2 separate Search And Filter :
– One with just a search field, display results as an archive, and i put the search code in my header instead of the current wp search.
– The other one with a Post_type field, display results as an archive, just to filter the results from the search.Im currently using Divi and made a child theme.
Also using ACF and Relevanssi.Trevor(Private) September 17, 2019 at 8:06 am #221139I have a feeling that Divi does something unusual for headers, so the re-write route (#1) may be needed.
For the results page, does it have a slug, or are you using the id of the form?
for example, does it look like this:
https://mysite.com/?sfid=1234&_sf_s=mysearchword
OR
https://mysite.com/search-results/?_sf_s=mysearchword
Anonymous(Private) September 17, 2019 at 10:54 am #221170Im still using the default search, so the url looks like this: http://mysite/?s=mysearchword
-
AuthorPosts