• Resolved patsky

    (@patsky)


    I’m using the following code to display events grouped by day for a week which works brilliantly – almost.

    [events_list_grouped mode="daily" date_format="l, F j, Y" location="2" scope="week"]#_EVENTLINK - #_EVENTTIMES<br />[/events_list_grouped]

    I get eight days of events and the week starts on Saturday. How do I make it start on Sunday? My WordPress General settings say Sunday and changing it has no effect.

    https://www.ads-software.com/plugins/events-manager/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Do you have Sunday set as the first day of the week under the main WordPress settings page?

    Thread Starter patsky

    (@patsky)

    Yes I do. Tried changing to another day and made no difference Still shows 8 days starting on Saturday. Not bothered about 8 days but do want it to start on Sunday.

    Oddly the documentation doesn’t show week as an option for scope but it does work up to this point.

    Thread Starter patsky

    (@patsky)

    Any more information /suggestions on this please?

    Where / how have you defined the week scope?

    Thread Starter patsky

    (@patsky)

    I have put this code in a text widget:

    [events_list_grouped mode="daily" location="2" scope="week"]#_EVENTLINK - #_EVENTTIMES<br />[/events_list_grouped]
    [location]

    which gives me this (perfect except it starts on Saturday not Sunday):

    Saturday, October 17, 2015
    Morning Prayer – 9:15 am – 9:45 am

    Sunday, October 18, 2015
    Holy Communion – 8:00 am – 9:00 am
    Parish Communion – 9:45 am – 10:30 am

    Wednesday, October 21, 2015
    Morning Prayer – 9:15 am – 9:45 am
    Holy Communion – 10:00 am – 11:00 am
    Coffee stop – 10:45 am – 12:00 pm

    Thursday, October 22, 2015
    Morning Prayer – 9:15 am – 9:45 am
    Church Singers’ rehearsal – 7:30 pm – 8:30 pm

    Friday, October 23, 2015
    Morning Prayer – 9:15 am – 9:45 am

    Saturday, October 24, 2015
    Morning Prayer – 9:15 am – 9:45 am

    Plugin Support angelo_nwl

    (@angelo_nwl)

    sorry but I think the scope means events this week and it will start depending on your events date.

    Thread Starter patsky

    (@patsky)

    Pity. And just realised it isnt this week anyway! Any way round this? Can I get a grouping of a number of days from today? Using a number of events doesn’t give complete days.

    Thread Starter patsky

    (@patsky)

    Have just discovered I can add my own scope so have used the code I found here which I have modified to display the next 7 days.

    Code here for anyone who wants it. Add it to your theme functions file:

    <?php
    add_filter( 'em_events_build_sql_conditions', 'my_em_scope_conditions',1,2);
    function my_em_scope_conditions($conditions, $args){
    	if( !empty($args['scope']) && $args['scope']=='7days' ){
    		$start_date = date('Y-m-d',current_time('timestamp'));
    		$end_date = date('Y-m-d',strtotime("+7 day", current_time('timestamp')));
    		$conditions['scope'] = " (event_start_date BETWEEN CAST('$start_date' AS DATE) AND CAST('$end_date' AS DATE)) OR (event_end_date BETWEEN CAST('$end_date' AS DATE) AND CAST('$start_date' AS DATE))";
    	}
    	return $conditions;
    }
    add_filter( 'em_get_scopes','my_em_scopes',1,1);
    function my_em_scopes($scopes){
    	$my_scopes = array(
    		'7days' => 'Next 7 days'
    	);
    	return $scopes + $my_scopes;
    }

    Perfect!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Grouped events – scope='week' starts Sat. Want Sun’ is closed to new replies.