I have a few filters set up to filter custom fields like "price".
But I wanted to ask if there was a possibility to not show the "No items found." message but posts that are closest to the entered value.
An example to understand this would be if the most expensive house is cheaper than the "minimum" typed price for the house of let's say $250.000 (Done with a "Number Custom Field" and a query of "equal or greater then"). So if the person who searched for $300.000 houses will still see all houses in descending order which would be in the case of this example $250.000 and down.
In my case, I list financial services and since Toolset doesn't support range sliders native I decided to use:
Hello. Thank you for contacting the Toolset support.
There is no native way but you can customize it as per your need using the Toolset View's hook: wpv_filter_query
=> https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
- Where you can fire a query before based on the price and check if it returns any value if no, then you can change the meta query value as per your requirement.
The above hook will fire before the view query fired.
There is another hook as well that if you would like to try: wpv_filter_query_post_process
=> https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query_post_process
- Where this hook will be fired after the views query executed so again you should check if no posts are returned you should adjust your query argument for post meta value and fire a custom query and returned the posts.
Thank you for this answer but I got another problem that has to do with views, I use bootstrap tooltips in my view but when I use Ajax refresh they break.
I tried adding:
jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) {
/**
* data.view_unique_id (string) The View unique ID hash
* data.layout (object) The jQuery object for the View layout wrapper
*/
jQuery('[data-toggle="tooltip"]').tooltip();
});
But it doesn't work.
New threads created by Minesh and linked to this one are listed below:
That is another issue. As per our support policy we entertain only one question per ticket. I'll split the ticket with your new question. You are welcome to close this ticket.