Way to limit hours displayed on calendar?

Home Forums Calendar Products Events Calendar PRO Way to limit hours displayed on calendar?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1233992
    Stuart’s
    Participant

    Hi-
    All of our events happen during the day. In an effort to have our calendar not display with so much white space, is there a way to limit the calendar to only display from 8am-10pm? Thanks

    #1234822
    Hunter
    Moderator

    Hi and welcome 🙂

    I found an existing snippet (shared below, add to your theme’s functions.php file to implement) which limits the hours displayed in Day view from 8am to 10pm. Does that work? Is there a specific view you’re trying to apply it on? Are you going for all views? Let me know and I’d be happy to help further assist.

    Thanks and take care!

    add_filter( 'tribe_events_week_get_hours', 'filter_week_hours' );
    function filter_week_hours( $hours ) {
    $hour = 0;

    foreach ( $hours as $key => $formatted_hour ) {
    if ( $hour < 8 || $hour > 22 ) {
    unset( $hours[ $hour ] );
    }

    $hour ++;
    }

    return $hours;
    }

    #1236266
    Stuart’s
    Participant

    Great, thanks! I think it’s just the list view where it was an issue for my client, so I assume that this code take care of that then?

    #1237818
    Hunter
    Moderator

    I believe it applies for Week view only, but try it out and if it doesn’t work for List view, I’ll see what I can come up with. I reached out to the developers for insight but haven’t heard back, so let me know what you find out and we’ll go from there. Thanks 🙂

    #1251835
    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 ‘Way to limit hours displayed on calendar?’ is closed to new replies.