Home › Forums › Calendar Products › Events Calendar PRO › Search results list repeating events – how to limt results?
- This topic has 6 replies, 3 voices, and was last updated 10 years, 2 months ago by
Support Droid.
-
AuthorPosts
-
December 19, 2015 at 2:35 pm #1044172
Ian
ParticipantThe title of the post hopefully says it all. – A search in WordPress returns all instances of an event. Information therefore repeats over and over. How does one limit the search results page using The Events Calendar Pro to show only one instance of an event?
I did find a post on this subject here but things seem to have changed so I cannot follow the advice?
December 21, 2015 at 6:42 pm #1044988Brook
ParticipantHowdy Ian,
Iam happy to explain how to do that. But I have to level with you, it’s going to be an advanced modification and require a fair bit of WP Query knowledge for you to write it.
In order to accomplish this you will tap into the WP_Query for the search page and exclude event child posts. Every recurrence of an event will be a child post, so excluding child posts that are events will hide all but the original event in the series.
If this is something you can write yourself, or perhaps don’t wnat to write yourself, please request it as a feature: UserVoice (feature suggestion page for The Events Calendar) If other people are interested in it as well we might be able to dedicate a few hours to getting a step-by-step tutorial or even a feature in the plugin that does this.
Does that all make sense? Will that work for you? Please let me know.
Cheers!
– Brook
December 22, 2015 at 1:14 pm #1045571Ian
ParticipantCan’t say I have a huge knowledge of WP_Query, but have modified WordPress template files before now in PHP so should be able to find my way around if you can give me some help with this.
Shame if it used to be an easy thing to switch off repeating events from the admin interface it is not presently supported in this way…
December 23, 2015 at 3:00 am #1045714Brook
ParticipantI certainly agree that it would be great to add this as a feature in the calendar. If you do end up suggesting it we can see if the demand is there, which probably would not require very much. From there we could build it as a feature in a future version.
But by the fastest way to get this will be to build it yourself. Please let me know if you have any questions. 🙂 Cheers!
– Brook
December 23, 2015 at 5:51 am #1045739Ian
ParticipantI have added a feature request.
Meantimes – any further syntactical detail on how to exclude event child posts or do I just need to wade in there and spend some hours looking for the relevant code sections and calls? Any example code out there at your end?
December 25, 2015 at 7:01 am #1046657Brook
ParticipantHowdy Ian,
There will definitely be some wading involved, but it should mostly be testing your own code to see if it works. In order to modify a query I strongly recommend hooking into pre_get_posts as this set of examples shows.
As you can see one of the examples is “Include Custom Post Types in Search Results”, which is not a bad place to start. It targets search queries only, which is what you want to do. From there you want to make sure that any post with the post_type tribe_events is not a WordPress child post.
Hopefully that gets you set off in the right direction. No need to really examine our code, but an understanding of WP post types including child posts will be needed to follow the above. Cheers!
– Brook
February 18, 2016 at 8:33 am #1076400Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Search results list repeating events – how to limt results?’ is closed to new replies.
