Exclude Recurring Events from This Week Widget

Home Forums Calendar Products Events Calendar PRO Exclude Recurring Events from This Week Widget

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1171662
    Brad Mitchell
    Participant

    I use the This Week widget on the homepage (https://theeventscalendar.com/knowledgebase/pro-widget-shortcodes/#this-week-shortcode). We only show a few events per day in this widget and have multiple recurring events. Because only a few events are shown, it looks like the events are the same every day.

    The General tab of the plugin’s settings page has an option to exclude recurring event instances, but it only affects the list view. Is there code I can add to exclude recurring events from the This Week widget?

    #1171834
    George
    Participant

    Hey @Drew,

    This would unfortunately only be possible with some custom coding, and is a bit tricky to do; however, I wrote up a quick code snippet here for you that might do the job:


    add_filter( 'tribe_events_pro_this_week_widget_query_args', 'tribe_prevent_recurring_instances_from_this_week' );

    function tribe_prevent_recurring_instances_from_this_week( $args ) {
    $args['post_parent'] = 0;
    return $args;
    }

    ☝️ Add that to your site and let me know if it helps!

    Cheers,
    George

    #1172019
    Brad Mitchell
    Participant

    Unfortunately that didn’t work. I added the snippet to my theme’s functions.php file then created a recurring event. The event still appeared on every day of the widget.

    In looking at our event more closely, more of them actually span multiple days instead of being recurring. It is possible instead to only show events that begin and start on the same day?

    #1172563
    George
    Participant

    Hey Drew,

    I’m sorry to hear this code snippet didn’t help.

    This is a tricky thing to pull off, unfortunately. We cannot help with writing custom code like this, but I will give this another shot.

    To clarify, you ask: “It is possible instead to only show events that begin and start on the same day?” Does recurrence matter here? What I mean is: if there is a recurring event whose instances start and end in the same day, should they be omitted from week views and week widgets because they’re recurring? Or does it not matter, and as long as the event starts and ends in same day, it should show up…?

    Thanks!
    George

    #1174148
    Brad Mitchell
    Participant

    It doesn’t matter if it’s recurring. If it begins and ends on the same day, it should show up.

    #1174157
    George
    Participant

    Thanks Drew. You say, “If it begins and ends on the same day, it should show up.” — to be clear, are there any issues with these events showing up now? Or are you just saying, if it begins and ends on the same day, it should show up, but if it does not begin and end on the same day, it should not show up?

    I’m sorry to ask another clarifying question here, but I just want to make sure whether you are reporting a bug or not.

    Sincerely,
    George

    #1174293
    Brad Mitchell
    Participant

    Correct, all events are displaying. If it begins and ends on the same day, it should show up, but if it does not begin and end on the same day, it should not show up.

    #1174359
    George
    Participant

    This reply is private.

    #1178084
    Brad Mitchell
    Participant

    This reply is private.

    #1178418
    George
    Participant

    This reply is private.

    #1189667
    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 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Exclude Recurring Events from This Week Widget’ is closed to new replies.