Forum
Problem with Events Listing
Hi,
The perch_events_listing almost does exactly what I want. Events on a particular day are all neatly listed under the relevant day. Events on different days are listed under their respective days. I want to show the first 8 events rather than the default 3. I have the standard perch events templates set up. I thought that all I would need to do is change my call from:
perch_events_listing();
to
<?php
perch_events_custom(array(
'filter' => 'eventDateTime',
'match' => 'gte',
'value' => date('Y-m-d'),
'count' => 8,
'sort'=>'eventDateTime',
'sort-order'=>'desc',
));
?>
This doesn't work though. It does print the first eight events, but all under the first day it comes across, even if an event is on a different day. I also tried adding in the standard template of event-day.html but that just yields the same results. ie. all future events are listed under the very first day, even if they're on different days.
With the perch_events_listing(); call, it all works fine and each set of events are listed under the correct relevant days.
I'm sure I'm just doing something really silly or missing something obvious, but can't figure out what is wrong - I'm using the standard events templates.
ignore the default 3 statement. I just want to list the first 8 events regardless of when they are.
This sounds like a templating issue. What does your template look like?
HI Drew,
It's just picking up the very first event day it finds, then looping around every single event up to 8 in the future, regardless of whether the future event belonged to that date or not. I wanted it to loop similar to the perch_events_listing():
ie. For each day that has an event: * List the day * - show event one on that day - show event two on that day - etc then loop back to the next day that has an event and repeat.
What's happening is: * I'm listing the first day I find that has an event on it. - list event one on that day - list event two on that day - list ever three (even though it's not on this day) - list event four (even though it's not on this day) - etc up to count.
So I never get any other day headings. It's missing the code above which initiates the first loop (over each day) and I'm not sure how to find it.
Your
<h3>
with the date is in theperch:before
section, so it will only ever display for the first item.I thought this template would handle the "multiple events on one day scenario", but I'm stuck on how to get perch to move on to loop to the next day that has events. What am I missing (apart from some grey matter)?
If I change the template to this, then I get the <h3> day listed for every event within that day. I only want the <h3> once for a day and all the events on that day underneath. Then repeat for next day that has events.
So basically for the next event, I don't want to repeat the <h3> day title if the next event is on the same day.
There's an example of that here:
https://forum.grabaperch.com/forum/12-11-2015-custom-events-listing
<perch:if different> That's just perfect Drew. I knew there would be some way but couldn't find it. Thanks so much for your patience and help.