Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Using filter on search results page after getting results with native WP search

Viewing 6 posts - 1 through 6 (of 6 total)
  • Yaniv Schneider
    #258587

    Hi guys,

    I am using a native WP search field with a hidden input to search within a custom post type:

    <input type="search" id="s" name="s" class="s" placeholder="Search" value="<?php echo esc_attr( get_search_query() ); ?>" autocomplete="off" />
    <input type="hidden" name="post_type" value="watches" />

    The search results page outputs the results which i echo using regular, default loop in search.php. The URL of the search results goes like this: ?s=rolex&post_type=watches

    In the search results page i have created a filter to filter the search results.

    The filter parameters are:
    – Display results method: As an archive
    – Use a custom template: true
    – Filename of the custom template: search.php

    The issue is that when i hit the filter button, it redirects me to blog page with the “Nothing Found” message. Could you tell me if it is possible to filter the search results which i get from the WP search or do i need to do something else?

    Thank you.

    Trevor Moderator
    #258591

    You can use a wordpress rewrite to point a theme global search to our form. There is an example here (the site shown uses a slug name for the search results page, which looks nicer):

    https://support.searchandfilter.com/forums/topic/using-default-wp-search-bar-to-show-sf-results-page/#post-243811

    Here there is an example of one that doesn’t use a slug:

    https://support.searchandfilter.com/forums/topic/how-to-maintain-search-string-while-filtering/#post-205209

    Note, the Search & Filter form on the results page must have a Text search field to receive the search string. You would not need/want to have the post type in the parameters, as this is specified in our form settings instead, so you should remove that from the code you already use.

    Yaniv Schneider
    #258636

    Hi Trevor,

    Thank you for your reply.

    With the rewrite point i still get the blog page with “Nothing Found” message, but this time without getting the search results page first. What i meant is to use the filter after the search results page is generated and inside the results page.

    I need the post type parameter as there are two searches what this site have. One is for blog posts and another is for the post type as the results have different styling.

    Could you point me on another possible solution?

    Trevor Moderator
    #258732

    Are you able to send me a live link/URL to your search page so I can take a look?

    Yaniv Schneider
    #258749

    Currently it is only on localhost, please do not close this topic, we will upload the site on live server within a week. Thank you for your help.

    Trevor Moderator
    #258753

    OK, I will wait for you to post again.

Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.