-
Search Results
-
Topic: Allow Blank Range Field
I have a range field with number inputs. I’ve figured out how to empty the default values out using the ‘sf_input_object_pre’ filter. However, when doing this I get 0 search results upon submitting the form. Basically, I’d like for this field to be optional. How can I achieve this?
Hi all
I have a client that requires a specific url structure for their pages but would like to use one common filter on those pages, although having different fields selected by default depending on the page.
I know it would makes sense to use archive pages, but it is very probable the client will want to add content to those pages so for now I am not considering them. But I could potentially use archive pages and add taxonomy images and the taxonomy description to the templates.
I understand that the next major release of this plugin will have a pretty permalinks option but unfortunately I can’t wait.
I have created “category” like pages and embedded the filter and shortcode to show results on each of those pages. I have also added a filter to sf_input_object_pre to set a default state to one of the fields, based upon the page id. The posts being filtered are a custom post type, trips, and I have used ACF fields instead of taxonomies in order to avoid a ridiculous amount of custom taxonomies.
I could continue to write code for each page but it would be hard to maintain. Also it appears that although the default option shows as selected on the initial page view, the results don’t reflect this. But I suppose this could be overcome with just a bit of javascript used to click the submit button after the page is ready.
The other option I see is to add an action to pre_get_posts to somehow limit what is shown. I quickly investigated this but it seemed a bit confusing. I limited the filter with this code:
if($query->post_type == ‘search-filter-widget’)
but haven’t really investigated further since it wasn’t obvious what needed to be changed.
What path would you suggest I take? I have only added a couple ‘trips’ so I can easily change direction at this point.
Support topiscs such as this one: https://support.searchandfilter.com/forums/topic/default-category-on-radio-selection/
and this one:
https://support.searchandfilter.com/forums/topic/rewrite-issue/were a great help but I get the idea there might be quicker solution. Any help you could give me would be greatly appreciated. I suppose the answer I am looking for is somewhere on these forums I just haven’t been able to find it !
thanks
Ken