Posted: June 18, 2019 at 8:29 pm
|
Hi, event espresso team, I have another problem need some help. We are currently using facetWP for events filtering. The events are queried correctly the first time events on events pages which are all upcoming events, but then upon any filtering, the facetWP query kick in, it’s returning all the espresso events as they are using the default WP_Query. I couldn’t figure out a way to modify the query so that it only returns the upcoming events. |
|
|
Hi, In the second screenshot you have code that’s passing https://gist.github.com/joshfeck/ae206b13b751743b08137e72dc55151e |
|
|
Hi Josh, I added the function and applied the filter in the facetWP query directly but the page won’t display anything. I also tried putting in the function file: |
|
it looks like the SQL is not right. Is there a way to clean the query before adding the join and where clause? |
It looks like you don’t need to add the join and where clause. Do you see how there are two of these? So if you remove the join and where, does one of those remain? Truth be told, I have not worked with facetwp so I don’t know what’s involved with adding custom queries to its query. |
|
|
Yea, but once I start filtering events without the custom filter, the query is back to the simple one where it queries all the espresso events like so: if I do enable the custom filter, it’s being injected on the first query shown in the screenshot which creates 2 join and where clause. |
It sounds like you need a way to hook in to the filtered query provided by facetWP (not the initial page load query). |
|
|
We are using a workaround at the moment by using the facetWP template on a custom page instead of the archive page. With the filters, it’s working fine now, just still need to find a way to sort it by event date. |
You may need to do a join on wp_esp_datetime. One thing to be aware of is events can have multiple dates, and in most use cases the date to use would be the next upcoming datetime (start date). Your use case may vary though. |
|
The support post ‘query upcoming events with facetwp’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.