-
Search Results
-
I have a filter set up to find all posts with a relationship to an ACF called “people”, it returns all results with a relationship to a “person” post but I would also like to return the “person” post itself in the search results.
What is the easiest way to include it in my results?
I have tried something like this:function people_filter( $query_args, $sfid ) { if($sfid == 7287) { if ($_GET["_sfm_people"] != "") { $query_args['p'] = intval($_GET["_sfm_people"]); } } return $query_args; } add_filter( 'sf_edit_query_args', 'people_filter', 10, 200 );
But this returns the “person” post only, I would instead like to add it to the already compiled results.
Hi there I recently followed the example https://support.searchandfilter.com/forums/topic/null-fields-not-returning-results/ as I have an identical issue.
I used this code pretty much verbatim and a print_r shows all the range fields have been removed from $sf_current_query, HOWEVER the search still behaves as though they are still there and is returning 0 results. If I manually edit the search URL it works fine.
How do I make sf_edit_query_args actually change the search?
Thanks,
Caroline
Hi,
I use two ACF fields (height and width) in a S&FPro search form. I want to make a calculation (height x width) before I hit search and want to use the result of that calculation in the search throught the field with the name ‘surface’. Is that possible with the hook sf_edit_query_args?
Can you show me an example on how to do that?
Kind Regards,
Peter
Hello :)!
I modified the main query for the posts of the custom post type archive with the filter ‘pre_get_posts’ changing the ‘post__in’ array of the query. The filtering is working, but the count number isn’t correct.
Maybe it’s because of the search&filter cache? Can you tell me how to modify the posts delivered to the search form so that the count is working? It seems that setting my own posts in “$query_args[‘post__in’]” within a “sf_edit_query_args”-filter is not working. What do I wrong?
And when V3 is coming?
Thank you!
Topic: Can not alter order
Hi Trevor,
some of my WooCommerce products have a meta key “_tribe_event_starttime” and with your plugin I have setup an AJAX filter ordering these products by that meta key.
Everything was fine for weeks but today I realized that the order has fallen back to the WC default (creation) “date”. You can see the result list by clicking on one of the big images on the top.https://obsthof-am-steinberg.de/produkt-kategorie/event-feste-kinder-musik/
As you can see the AJAX requests has the GET parameter orderby=date and I tried to alter this order by hooking into your filter which I found here on your website:
// alter query for search & filter results
add_filter( ‘sf_edit_query_args’, ‘sf_orderby_eventdate’, 10, 2 );
function sf_orderby_eventdate ($query_args, $sfid) {
if ($sfid == 6047) {
$query_args[“meta_key”] = ‘_tribe_event_starttime’;
$query_args[“order_by”] = ‘meta_value’;
$query_args[“order”] = ‘ASC’;
}
return $query_args;
}Without success. I have installed WP Super Cache last week. Could this be the reason? Is there anything I missed or doing wrong?
Thank you for your support!
OliverNow I am