Forums Forums Search & Filter Pro Search in a header, display on a archive page.

Tagged: , , , ,

Viewing 10 posts - 1 through 10 (of 12 total)
  • Anonymous
    #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
    #221068

    Splitting 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
    #221092

    Hello 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
    #221117

    Step #2 is easiest, IF the theme files are relatively simple.

    The first thing to do is make sure you are using a child theme. If you are not, Orbisius do a child theme maker plugin which is easy to use.

    Anonymous
    #221119

    Im using Divi as a theme, and i do have a child theme.
    And yes, the theme files are quite simple.

    Trevor
    #221121

    Can you find the template file that has the header and the search form in it?

    Or, do you use a (visual) header builder to make the header?

    Anonymous
    #221135

    I can find the template file.

    Trevor
    #221139

    I 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
    #221170

    Im still using the default search, so the url looks like this: http://mysite/?s=mysearchword

    Trevor
    #221172

    If you have added the Search & Filter form (and add a search box to that form, as you will need to anyway) to a page and tested it, what does the URL look like?

Viewing 10 posts - 1 through 10 (of 12 total)