Home › Forums › Calendar Products › Filter Bar › Filter recurring Events
- This topic has 5 replies, 4 voices, and was last updated 9 years, 6 months ago by
Nico Rettinger.
-
AuthorPosts
-
September 27, 2016 at 4:13 am #1169128
Nico Rettinger
ParticipantHello,
i use the Filter Bar in combination with the Event Calendar PRO. We`ve recurring events nearly every day and normal events on top, so the month view is full of recurring events which are not as important as the normal ones.
Is there an opportunity to filter out the recurring events with the filter bar and just display the normal ones and the other way around?
Thanks for your reply!
Greets
September 28, 2016 at 6:14 am #1169734Nico
MemberHey Nico,
Thanks for getting in touch with us 🙂
Is there an opportunity to filter out the recurring events with the filter bar and just display the normal ones and the other way around?
No, there’s not option to do this in the Filter Bar. But there are two options in WP-Admin > Events > Settings > General > Recurring event instances / Front-end recurring event instances toggle, please check them out and let me know if this is what you are looking for.
Best,
NicoSeptember 28, 2016 at 8:57 am #1169838Nico Rettinger
ParticipantHey Nico,
thanks for your reply! Sadly these are not the options i was looking for…
Is it possible to create a custom filter so you just can check/uncheck “Recurring Events” in the Filter Bar?Greets
Nico
September 29, 2016 at 7:20 am #1170351Nico
MemberThanks for following up!
I crafted a sample custom filter for this (not heavily tested). You might need to tweak it a bit to fit your needs, but I guess it’s a good starting point 🙂
/* Tribe, add custom filter to show/hide instances of recurring events */
if ( class_exists('Tribe__Events__Filterbar__Filter') ) {class Tribe__Events__Filterbar__Filters__Recurring extends Tribe__Events__Filterbar__Filter {
public $type = 'radio';
public function get_admin_form() {
return $this->get_title_field();
}protected function get_values() {
return array( array( 'name' => 'Show', 'value' => 'show'), array( 'name' => 'Hide', 'value' => 'hide'));
}protected function pre_get_posts( WP_Query $query ) {
$values = (array) $this->currentValue;
if ( $values[0] == 'hide' ) {
$query->set( 'post_parent', 0 );
}}
}new Tribe__Events__Filterbar__Filters__Recurring( 'Recurring Events', 'recurring' );
}
Just paste the code above in your theme’s (or child theme’s) functions.php file, activate the new filter in the admin (Events > Settings > Filters) and let me know if this is what you were looking for,
Best,
NicoOctober 21, 2016 at 9:35 am #1180658Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Filter recurring Events’ is closed to new replies.
