Home › Forums › Calendar Products › Events Calendar PRO › Custom Upcoming Event Display
- This topic has 7 replies, 4 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
January 15, 2012 at 6:36 am #13395
Xpert
MemberI am using custom loop to generate the upcoming events. I would like to list the event as ‘Now’, ‘Soon’ and ‘Upcoming’ . Since I was in hurry and i am not good at programming 🙁 , I decided to assign category for events- like, ‘now’, ‘soon’ etc!. It works fine but that was not exactly i want.
1) List the events that occurring on the current day as ‘NOW’.
2) List the events from next 30 days except ‘Now’ as ‘Soon’.
3) List all other events as ‘Upcoming’.This is the loop i am using.
'upcoming', 'eventCat' => 15,'posts_per_page'=>50) );
foreach($upcoming as $post) : setup_postdata($post);?>
Thanks in advance.
January 15, 2012 at 6:37 am #13396Xpert
Member
global $post;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$upcoming = tribe_get_events( array('eventDisplay'=>'upcoming', 'eventCat' => 15,'posts_per_page'=>50) );
foreach($upcoming as $post) : setup_postdata($post)
January 16, 2012 at 4:15 pm #13434Rob
MemberHey Xpert. Thanks for sharing this. I’m not sure about this, but let me get our dev Jonah to take a look and see if he can offer up any suggestions.
January 16, 2012 at 7:55 pm #13474Jonah
ParticipantHey Xpert,
For #1 and #2, you can use the ‘start_date’ and ‘end_date’ arguments in the query to set your date range. You’ll need to figure out how to get today’s date and the next 30 days from todays date but that shouldn’t be too hard to Google.
For #3 you can just use ‘eventDisplay’=>’upcoming’ and that will pull in only your upcoming events.
Let us know if you need anything else.
January 17, 2012 at 11:43 pm #13557Xpert
MemberHi Jonah,
Thank you for your tips. I am using below code to list the events after 7 days. But unfortunately didn’t work.
Any solutions?.
$CurrentDate = date('j M Y');
$week = date('W');
$Sevendays= date('j M Y', strtotime('7 days'));
echo $Sevendays;
$soon = tribe_get_events(array('eventDisplay'=>'upcoming','start_date'>$Sevendays,'posts_per_page'=>50) );
foreach($soon as $post) : setup_postdata($post);?>
Thank you.
January 18, 2012 at 7:50 am #13567Rob
MemberHey Xpert. Jonah can take another look at this to see what’s wrong, but ultimately it’s going to be up to you to figure out the right code to use (as we just don’t have the support bandwidth to provide specific guidance on every custom request out there, unfortunately). Hopefully he can point you in the right direction with another quick look.
January 18, 2012 at 8:30 am #13572Jonah
ParticipantHi Xpert, you’re going to want to pass in an end date as well. In your example above you could set the end date like so:
$EndDate = date('j M Y', strtotime('30 days'));
So I think you would want to use ‘start_date’=>$CurrentDate and ‘end_date’=>$EndDate
Also, I don’t think you need the eventDisplay arg in there. This works for me.
– Jonah
July 3, 2015 at 5:00 pm #975320Support 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 ‘Custom Upcoming Event Display’ is closed to new replies.
