keep the search request

Forums › Forums › Search & Filter Pro › keep the search request

  • This topic has 5 replies, 2 voices, and was last updated 9 years ago by Anonymous.
Viewing 6 posts – 1 through 6 (of 6 total)
  • Anonymous
    #137538

    hello

    first thank for the nice plugin it’s a real time saver and good programmation.
    I have a question but not sure if I should ask you or to developper of theme I am using.
    I have a custom search button already in my theme (classiera),
    once I request something I get the search results
    I inserted as a tool bar the custom filter from search-filter-pro (by adding this line <?php echo do_shortcode(‘[searchandfilter id=”285381″]’); ?> in search.php in my child theme

    If I want to apply filters I need to re enter the searched word, is there a way to pre fill the keyword search. ideally I want to skip the part where I have to renter the search keyword.

    Thank you in advance

    Trevor
    #137548

    If your theme sends the request as ours does, e.g. http://mysite.com/search/?_sf_s=hello

    That would be a matter of editing the theme template(s). You should always use a child theme if you do this, unless your theme is entirely bespoke.

    Anonymous
    #137552

    Hell Trevor,

    thank you for the quick answer…

    How can I check this ?
    I think I see something related to this in the theme at some point there is those lines :

    $args = array('post_type' => 'post',
    'post_status' => 'publish',
    's'   => $keyword,
    'posts_per_page' => -1,
    'category_name' => $catSearchID,
    'meta_query' => array('relation' => 'AND',$searchQueryPrice,$searchQueryCountry,$searchQueryState,$searchQueryCity,$searchCondition,$searchQueryCustomFields,),);

    so I guess I need to use the ‘s’, right ?
    but then how do I tell the plugin that the search is ‘s’ and not yours (_sd_s I think)

    sorry to disturb with stupid questions…I am no real programmer, I am a graphic designer learning the hard way programming php and wordpress

    Trevor
    #137560

    Is that in the search.php template. Somewhere in our forum the developer has posted an answer. I need to find it for you.

    Trevor
    #137639

    I have a feeling that this reply was what I was looking for. It was in reply to a similar question, but Ross’ reply was private, so I have grabbed part of the reply that applies (sort of):

    This is not really a S&F feature, but its quite simple to do – I wasn’t 100% sure so I didn’t make the change myself:

    In your header.php file you must modify the search form.

    On line 437 you have this:

    <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
    

    This means all the searches go to your home_url, to send searches somewhere else, update it with the page you want – in this case the results url, so change this to:

    <form role="search" method="get" id="searchform" action="<?php echo home_url( 'results' ); ?>">
    

    Now the search is going the right place, what needs to happen next is the correct query param is added to the URL. S&F doesn’t use ?s=searchterm it uses ?_sf_s=searchterm – which means you need to update your search input field – and rename this from name="s" to name="_sf_s".

    For some reason in your header code I see a strange if/else on the field (so there are two versions) – so I would update both lines 441 and 444.

    So line 441 would become

    <input type="text" placeholder="<?php _e( 'Search', 'squarecode' ); ?>" value="<?php echo $searchresults; ?>" name="_sf_s" id="s" />
    

    and line 444 would become

    <input type="text" value="" name="_sf_s" id="s" placeholder="<?php _e( 'Search', 'squarecode' ); ?>" />
    

    Can you see what he means by this (not directly applicable to you, but the header.php files is where your search box is located, yes?

    Anonymous
    #137812

    it looks like it might save my life yes !
    I think it not header .php but what ever it s for sure in some php template which I should be able to find. Ok great for the help

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

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.