Forums Forums Search & Filter Pro Search Term Carry Through

Viewing 4 posts - 1 through 4 (of 4 total)
  • Ross Moderator
    #26012

    Hey 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
    #26057

    Ross,

    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
    #26100

    Ross,

    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
    #26231

    Hey 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, as s. So as long as that plugin is checking for the search term inside the query object, rather than from $_GET it should work.

    Aside from that, some plugins look for a variable is_search in 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

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