Filter recurring Events

Home Forums Calendar Products Filter Bar Filter recurring Events

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1169128
    Nico Rettinger
    Participant

    Hello,

    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

    #1169734
    Nico
    Member

    Hey 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,
    Nico

    #1169838
    Nico Rettinger
    Participant

    Hey 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

    #1170351
    Nico
    Member

    Thanks 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,
    Nico

    #1180658
    Support Droid
    Keymaster

    Hey 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

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Filter recurring Events’ is closed to new replies.