Accepted Arguments : future, past, today, tomorrow, month, next-month, 1-months, 2-months, 3-months, 6-months, 12-months, all
🙁
try this by adding to your theme functions.php
By using a shortcode:
[events_list scope=”this-week”]
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'] == 'this-week' ){
$start_date = date('Y-m-d', strtotime('Last Monday', time()));
$end_date = date('Y-m-d', strtotime('Next Sunday', time()));
$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;
}
agelonwl can I send you a personal message?
agelonwl I have added your code to the functions.php and when I add 1 recurrent event to a category the event appears twice.
I use the shortcode like :
[events_list category=”41″ scope=”this-week”]
How can I resolve this?
can you try to change this line
$start_date = date('Y-m-d', strtotime('Last Monday', time()));
to
$week_number = date('w');
$start_date = date("Y-m-d",time() - ($week_number - 1)*ONE_DAY);
do you have a sample link?
hi agelonwl,
after looking at the above code you wrote I came to the conclusion this is not what I want.
Because when I look on the website on wednesday, this query doesn’t show the events previous to wednesday.
I want to show all days of the week. Actually only the coming events for the current day and coming 6 days
please help.
thanks
Hi,
do you have a sample link with sample events?
http://www.vanrheenensport.nl/budo-sport-almere/karate-almere/
everything works fine now but when we reach thursday you wont see the previous days.
Am going to try this and update you.