Forums › Forums › Search & Filter Pro › Search Term Carry Through
- This topic has 4 replies, 2 voices, and was last updated 10 years, 5 months ago by
Ross.
-
Anonymous(Private) September 25, 2015 at 10:02 pm #25929
I just upgraded to the premium version from the free one. And, I am trying to duplicate something I had going with the free version. Here is what I had with free version:
I use a custom search form on homepage (created by a widget), where visitors put in just their zip code. This search took them to a page, where I had the free version widget in the sidebar. In the free version, the zip code that was put input on the homepage search form carried over to free version. That carry over does not appear to be happening here. Is there a way make that happen or get that same result with the paid version?
Ross Moderator(Private) September 28, 2015 at 11:05 am #26012Hey Brent
S&F Pro uses a different variable for the Search Parameter – so if you a do a search using regular WP and look at the URL you will have a
?s=However if you do a search using S&F pro you will see
?_sf_s=So likely in your frontend form, you just need to rename the search field to
_sf_s🙂Thanks
Anonymous(Private) September 28, 2015 at 2:40 pm #26057Ross,
Thanks for responding. Not a coder, but here is what I tried and it broke the search. Below is code that I believe generates the search form. Where it says name=”s” I changed that to name=”_sf_s”. When I did that, it could not find any results. Am I changing the correct thing? Can I change it in S&F Pro to just “s”? If so, where is that? I need an option.
echo '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" ><input type="searchbox" value="" name="s" /><input type="hidden" value="listing" name="post_type" />'; foreach ( $listings_taxonomies as $tax => $data ) { if ( ! isset( $instance[$tax] ) || ! $instance[$tax] ) continue; $terms = get_terms( $tax, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => 100, 'hierarchical' => false ) ); if ( empty( $terms ) ) continue; $current = ! empty( $wp_query->query_vars[$tax] ) ? $wp_query->query_vars[$tax] : ''; echo "<select name='$tax' id='$tax' class='agentpress-taxonomy'>\n\t"; echo '<option value="" ' . selected( $current == '', true, false ) . ">{$data['labels']['name']}</option>\n"; foreach ( (array) $terms as $term ) echo "\t<option value='{$term->slug}' " . selected( $current, $term->slug, false ) . ">{$term->name}</option>\n"; echo '</select>'; }Anonymous(Private) September 28, 2015 at 7:18 pm #26100Ross,
I have determined some additional facts that might help you help me. The search form on the home page is designed to search for zip codes. I have zip codes stored in a custom field. The current search form searches custom fields because I was also using the SearchEverything plugin and had limited the search down to custom fields.
When I change name”s” in the code above, to “_sf_s” I am not able to search the custom fields any longer, that is why I was getting no search results.
Secondarily, when I search by title, I see that the results are not displaying in the sidebar-content format as I have designated on the site.
With what I said in the previous email and this additional information, how do I pass through the initial search term to S&F pro?
Ross Moderator(Private) September 30, 2015 at 2:08 pm #26231Hey Brent
I think I follow you.
We actually support Relevanssi (https://wordpress.org/plugins/relevanssi/) which allows you to do a similar thing if that helps.
Aside from that, the search term (whether it comes from
$_GET['_sf_s']or$_GET['s']is passed in the standard way to the WordPress query, ass. So as long as that plugin is checking for the search term inside the query object, rather than from$_GETit should work.Aside from that, some plugins look for a variable
is_searchin the query, and if its true will perform their actions on that.If this is the case, then I have just emailed you an update. Once you have installed the update – head to the “advanced” tab and tick “force is_search to be true”.
This might do the trick.
FYI, this checkbox in the current version is actually broken (so don’t bother with it until you update) – the zip I emailed you has a fix for this problem.
Thanks
-
AuthorPosts