Home › Forums › Calendar Products › Events Calendar PRO › problem with tribe_get_events(); showing repeated start date
- This topic has 9 replies, 3 voices, and was last updated 12 years ago by
Barry.
-
AuthorPosts
-
March 3, 2014 at 11:17 am #111668
sunvalleycenter
Participantpage is http://sunvalleycenter.org/education-humanities/classes-workshops
Using this query:
$show_events_category = get_post_meta($post->ID, get_theme_prefix() . ‘show_events_category’, true);
$eventDisplay = isset($_GET[‘pastEvents’]) ? ‘past’ : ‘upcoming’;
$posts = tribe_get_events(
array(
“post_type” => “tribe_events”,
‘eventDisplay’ => $eventDisplay,
‘tax_query’=> array(
array(
‘taxonomy’ => ‘tribe_events_cat’,
‘field’ => ‘slug’,
‘terms’ => $show_events_category
)
),
“numberposts” => -1
)
);
The event date always shows the start date, not the sequential dates of the event so event is repeated many time with same date.
<?php if (!tribe_get_all_day()):?>
<h3><?php echo date(‘l, F j, g:i a’, strtotime(tribe_get_start_date())); ?></h3>
<?php else :?>
<h3><?php echo date(‘l, F j’, strtotime(tribe_get_start_date())); ?></h3>
<?php endif; ?>
What do I need to do to get proper dates to show?March 3, 2014 at 4:50 pm #111913Barry
MemberHi – unfortunately the forum doesn’t do a great job when it comes to sharing code.
Can I ask you to share that code via a Pastebin link or via some similar service? It looks like you may not be looping through the query results which might partly explain this, but I’m not sure if that may simply be because code has been stripped out by the forum.
Let us know!
March 4, 2014 at 9:58 am #112328sunvalleycenter
ParticipantThanks so much for looking – here is pastebin link: http://pastebin.com/XPGtvRTD
and page with issue is http://sunvalleycenter.org/education-humanities/classes-workshops
You can see that class such as “1st-3rd Grade Spring Break Art Camp with Danica Robrahn” is repeated several times with the same date rather than progressive dates for the event.
THANKS AGAIN!March 4, 2014 at 12:12 pm #112424Barry
MemberAre those affected events recurring events, do you know? Generally speaking it is best to setup the post data as documented in the Codex rather than directly retrieving items from the array in the query result – certainly if you are using recurring events this is a good idea as otherwise (at this time) it is difficult for The Events Calendar/Events Calendar PRO to distinguish between instances of an event, since they all share a common post ID.
Is there a reason why you can’t use (and customize) the default upcoming event list?
March 4, 2014 at 12:16 pm #112428Barry
Member(Slightly off topic, but I just wanted to say that is a fantastic looking site and some impressive work that you’ve done so far in customizing the calendar output.)
March 5, 2014 at 8:00 am #113055sunvalleycenter
ParticipantYes recurring events. I wish I could take more credit but am picking up this site from past developers. There is a page where events/list.php is used and the events then show correctly. http://sunvalleycenter.org/events-calendar/upcoming
That is basically the exact same content as this page I am trying to fix and I assumed there was some reason why that could not be used in this case instead of page.php. So you are saying use the same loop as in events/list.php instead. Is there some setup I need to do before the loop?March 5, 2014 at 8:44 am #113108Barry
MemberIt looked (and I could have easily been mistkaen 😉 ) like you were building a sort of replacement list view, I just wondered if you could use the existing list view and customize from there. In terms of setting the loop up, the WP Codex shows how you can pull posts in a more conventional style. I’m afraid though since this is really the domain of custom development we can’t offer too much more help with this.
March 5, 2014 at 8:52 am #113146snorton
Participant@sunvalleycenter , I had a similar situation where I wanted to build a custom list view. This will need to be modified to fit your needs, but outputs recurring event dates correctly without repeating the initial event date:
http://pastebin.com/NzGyFxEzMarch 5, 2014 at 9:16 am #113343sunvalleycenter
ParticipantThanks for all the help – I’ll take it from here and will post back if I run into any specific questions but now I have a GREAT starting point.
April 21, 2014 at 7:40 am #138301Barry
MemberClosing this thread as it’s been quite a while – of course if we can help with anything else please do create a new thread. Thanks!
-
AuthorPosts
- The topic ‘problem with tribe_get_events(); showing repeated start date’ is closed to new replies.
