Make a week span 8 days in this week – widget?

Home Forums Calendar Products Events Calendar PRO Make a week span 8 days in this week – widget?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1306310
    Anders
    Participant

    Hi There,
    is there a way to make the week span 8 days in the “This Week” widget?
    I need to include both Sundays around any given week.

    Or – if there is a way to set the start day for the This Week widget only, to start on Mondays, that might be an acceptable work around. I can’t change the global settings though, since that would also change the monthly view in the main calendar.

    /anders

    #1310151
    Barry
    Member

    Hi Anders,

    If you have an event spanning a long period of time – suppose it started 4 weeks ago and ends 4 weeks from now – it should indeed appear in the This Week widget’s output.

    Are you finding that isn’t the case, or is there something about the way this works you want to tweak further? I’m not completely clear as to the end goal here – so any extra info you can provide would be appreciated!

    Thanks 🙂

    #1310153
    Anders
    Participant

    No – I’m not talking about events that span multiple weeks.

    is there a way to make the week span 8 days in the “This Week” widget?
    I need to include both Sundays around any given week.

    The end goal would be to have a list where both Sundays around a given week is included. Like this:

    Sunday
    - Events here - 
    Monday 
    - Events here - 
    etc..
    Saturday
    - Events here - 
    Sunday 
    - Events here - 

    The use case is when working with churches who have a lot of things going on on Sundays, the current setup limits the upcoming events week view to either display Sundays first and then the rest of the week (but not next Sunday.). That is less then ideal.
    Or you would have to set the global settings in WP to have the week begin on a Monday (and have Sundays listed at the bottom of the Weekly Events widget.) This is also less then ideal, since it would mean all other views (like the monthly calendar etc) would be effected by this setting.

    So – is there a way to override the 7 day setting in the weekly view widget and have it include 8 days, starting and ending with Sundays?

    /anders

    #1310160
    Barry
    Member

    Thanks for clarifying, Anders – I see what you mean now.

    As a piece of customization work you can certainly tweak the arguments used to build the query using the following hook:

    tribe_events_pro_this_week_widget_query_args

    Modifying either the start_date or end_date field (or both) could work for you here. Here’s an example, assuming that in practice all you really need to do is push out the end date by one day:

    add_filter( 'tribe_events_pro_this_week_widget_query_args', function( array $args ) {
    	$end_date = strtotime( $args['end_date'] ) + DAY_IN_SECONDS;
    	$args['end_date'] = date( 'Y-m-d', $end_date );
    	return $args;
    } );

    You could of course pull the start date back a day using a similar approach (and this code could be placed inside a custom plugin).

    Does that work for you, at least as a starting point you can build on?

    #1310162
    Anders
    Participant

    Great. That’s the starting point I was looking for. I’ll look into this next week, but for now we’re all good!

    #1310166
    Barry
    Member

    Fantastic 🙂

    #1323900
    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 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Make a week span 8 days in this week – widget?’ is closed to new replies.