Home › Forums › Calendar Products › Events Calendar PRO › Date Range and Mini Calendar Question
- This topic has 5 replies, 3 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
August 2, 2013 at 1:25 pm #58545
Patrick Sasser
ParticipantI have two questions
1) I’m trying to use a WP Query to select events in a date range. I want to select events from today until the next seven days. Here’s the code that I’m using…$current_date = date(‘j M Y’);
$end_date = date(‘j M Y’, strtotime(‘+7 days’));
$upcoming = new WP_Query();
$upcoming->query( array(
‘post_type’=> ‘tribe_events’,
‘eventDisplay’ => ‘upcoming’,
‘posts_per_page’ => -1,
‘start_date’=>$current_date,
‘end_date’=>$end_date,
‘tribe_events_cat’ => ‘Events Area’)
);
if ($upcoming->have_posts()) :
while ($upcoming->have_posts()) :
$upcoming->the_post();//excecute my stuff here
endwhile;
endif;unfortunately this code is returning events that aren’t occurring in the next seven days. Any thoughts?
2) The mini calendar is much improved in version three, but upon initial load of the calendar it shows my next 5 upcoming events (because that’s the setting I have chosen in the widget setting). I don’t want it to show the next 5 upcoming events. Instead I want it to only show the events for today’s date. If no events occur on today then I want it to say “No Events Today” is there any way that I can do that?
August 5, 2013 at 8:00 am #58829Barry
MemberHi psasser – it’s important that you create separate threads for separate issues in order to avoid confusion. Can you post your second issue in a new thread?
August 5, 2013 at 8:02 am #58830Barry
MemberUnfortunately this code is returning events that aren’t occurring in the next seven days. Any thoughts?
We can’t do too much when it comes to custom code like this, but some thoughts are:
* It would be better to use a yyyy-mm-dd format (Y-m-d) for your dates
* You may prefer to use custom for eventDisplay
* Remember also that tribe_get_events() accepts and functions like WP_Query but may be better in some circumstancesAugust 5, 2013 at 9:01 am #58839Patrick Sasser
ParticipantThanks so much for the tip and the information. I moved the mini calendar question to a new forum…https://theeventscalendar.com/support/forums/topic/mini-calendar-question/. The Tip you gave about date format being in yyyy-mm-dd worked perfectly and fixed my issue. Thanks so much for the help.
August 5, 2013 at 10:04 am #58843Barry
MemberGreat! One of the team (possibly me) will be along to address the other thread shortly 🙂
July 7, 2015 at 6:27 am #979762Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Date Range and Mini Calendar Question’ is closed to new replies.
