Filtering events to show in WordPress Search results

Home Forums Calendar Products Events Calendar PRO Filtering events to show in WordPress Search results

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #946844
    Nick Oakes
    Participant

    Hi All,

    Our theme uses a “standard” WordPress search box and associated “search.php” template to display the results and all our “normal” posts and pages are returned if relevant to the search query.

    What I’d like to do is filter the results (or pre-adjust the query) so that those Events returned relevant to the search query are –

    1) if single event, those on today and in the future only.
    2) if recurring, just show one event, whether that be today, or the next nearest one in the future (otherwise the search results get swamped with all the recurring events)

    Has anyone got any ideas ?

    Presently experimenting with “pre_get_posts” hook to no avail.
    Many thanks, cheers for now…………

    #946940
    Geoff
    Member

    Hey there, Nick! Thanks for getting in touch and welcome to the forums. I hope you’ve been enjoying the PRO plugin so far. 🙂

    Good question. I do want to point out that we are fairly limited in how much we can support custom development questions like this one. That said, I’m happy to try to point you in the right direction if I can.

    I wonder if working with meta_query would be the better route here. For example, here’s a post where someone was able to modify the query using <i>EventStartDate</i> as a parameter to limit results to current events, plus ones one week into the future. The post is a little dated, but I think it still offers a good starting point for what you’re looking for.

    We do have a function that allows you to distinguish between one instance of a recurring series and all instances called tribe_recurring_instances_toggle(). You could add a condition to your query that specifies that the toggle is set to respect your settings in Events > Settings > General that only one instance is displayed.

    I hope this helps point you in the right direction!

    Cheers,
    Geoff

    #950261
    Geoff
    Member

    Hi there, Nick! This thread’s been quiet for a couple of weeks now, so I’m going to go ahead and close it. Please feel free to start a new thread if any other question pop up–we’d be happy to help. 🙂

    Cheers!
    Geoff

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Filtering events to show in WordPress Search results’ is closed to new replies.