Home › Forums › Calendar Products › Events Calendar PRO › WP search brings up past recurring event
- This topic has 3 replies, 2 voices, and was last updated 9 years, 4 months ago by Geoff.
-
AuthorPosts
-
December 23, 2014 at 11:07 am #924339terrizsoloParticipant
I found a partial solution to get the search results to only show ONE instance (https://theeventscalendar.com/support/forums/topic/exclude-recurrent-events-from-search-results-except-from-first-instance/), however it is showing the first instance, i.e. in the past.
I have “Show only the first instance of each recurring event (only affects list-style views)” checked. (Works just fine in list view.)
Is there a way to instead get search to show
a) the next instance (i.e., in the future) – the second comment on this feature request indicates this is possible? https://tribe.uservoice.com/forums/195723-feature-ideas/suggestions/5229366-exclude-past-events-and-or-recurrent-events-from-t
Or,
b) The main page for a recurring event (that lists all upcoming instances of that event)December 24, 2014 at 8:31 am #924732GeoffMemberHi there, Terri!
Great question. I do want to note first of all, though, that we are fairly limited in terms of helping out with custom development questions like this one. That said, we’d love to point you in the right direction if we can.
One idea is to specifically declare upcoming events in the query. For example:
$query->query_vars['eventDisplay'] == 'upcoming';
Another idea is to output the All Occurrences link when displaying a recurring event in search. To do that, you would use the tribe_all_occurences_link() function in your search loop.
Sorry I don’t have a concrete solution for you here, but I hope this at least gets you started. Our documentation is also a great place to get more info on the various functions and hooks that are available.
Cheers!
GeoffDecember 24, 2014 at 11:27 am #924789terrizsoloParticipantThanks Geoff, for responding on Christmas Eve!
(As noted by several others who have looked for a solution to this, I understand the stance on not being able to support customizations, but it seems like a basic capability that should be built-in – if you can choose to show (or not) all recurring events in list view, to me it just seems logical that you should be able to choose to show them (or not) in WP search.)
I couldn’t figure out where to put the query_vars line in my function, but your second suggestion I was able to make work. For anyone else trying this:
<?php if (tribe_is_recurring_event() == 'true') : ?> <a href="<?php tribe_all_occurences_link ( get_the_ID(), 'true' ); ?>" rel="bookmark"><?php the_title(); ?></a> <?php else : ?> <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a> <?php endif; ?>
Merry Christmas 🙂
December 26, 2014 at 7:42 am #925427GeoffMemberAwesome! I’m so glad that worked out, Terri. Great job and thanks for sharing the code–that will definitely come in handy for others searching for the same thing. 🙂
Just as a side note, we’re always taking new feature suggestions over on our UserVoice page. Feel free to share things you’d like to see included in future releases and others will be able to vote on them as well.
Cheers!
Geoff -
AuthorPosts
- The topic ‘WP search brings up past recurring event’ is closed to new replies.