Posted: April 21, 2014 at 12:19 pm
|
Hello, I have made a custom event view template to display my events in a simple list. I want to show the 5 upcoming events that have not expired. We have about 20 events per day which consist of one hour fitness classes. These classes have registration open midnight the day before and close at the end of class. So a 6:00am class on Monday would be open for registration at 12:01am on Sunday and registration would close at class end (7:00 am). However if I have an event_list and want to show 10 fitness classes per page of which 5 are now over (if it is 10am Monday) only 5 classes will be displayed; once I click next on the pagination the next 10 classes will populate. If 10 classes are over for the day no classes will populate and I will need to click the pagination to see any classes. I want to have the first list have a complete 10 classes. What can I do to fix this? A related issue I found was when using event_custom_view. I tell it not to display expired events and yet they are visible and shows a closed button. How do I hide these closed events? Thank you. |
|
Hi Clair, We have a ticket outstanding looking into the expired events issue, I’ll add the notes here to it. Regarding the expired events on the Calendar Table template, that actually part of the design. I can add a feature request to look to remove that for future versions but I cannot say when that will be acted upon. |
|
Thanks Dean. Would there be a way to hide or skip closed events on the calendar table template? Also how would I go about changing the output from the date to the event time? Thank you. |
Hi Clair, Are you using the Calendar Table Template using the shortcode:
Or the default ‘Events Table’ using just simply:
as these are two different templates so would require different modifications therefor I just want to confirm beforehand.
If you prefer not to display closed events at all for any instance of [EVENT_CUSTOM_VIEW] regardless of the template in use, you can edit the Custom Template Add-on file. If you open up espresso-custom-templates/index.php go to line 152 you should find: $sql .= $show_expired == 'false' ? " AND (e.start_date >= '" . date('Y-m-d') . "' OR e.event_status = 'O' OR e.registration_end >= '" . date('Y-m-d') . "') " : ''; Change that line to: $sql .= $show_expired == 'false' ? " AND (e.start_date >= '" . date('Y-m-d') . "') AND (e.event_status = 'O' OR e.registration_end >= '" . date('Y-m-d') . "') " : ''; What this does is display events that: 1. Have a start_date greater or equal to today That will exclude any events that are not active and open for registration. If you do want this to be site-wide we can guide you as to the correct code to edit within the templates, but I would need to know which shortcode you are currently using as to not cause confusion between the two. |
|
|
Hi Tony, This is great. But, I am trying to edit a specific template I made. I pretty much took the events_table template and moved things around to fit my needs. The outputs are more or less identical. What changes would I need to make to have the events_table template only display open events? Thank you. |
The changed described above would be the preferred method and will also work for your custom template. The Custom Template Add-on runs the query to pull the events then the templates (or custom templates) are used to display those events. However using the events-table template if you look on lines 87-90 (yours may be slightly different) you’ll find: if ($event_status == 'NOT_ACTIVE') { $live_button = __('Closed', 'event_espresso'); $cart_link = ''; } Simply add a ‘break’ within that conditional. For example: if ($event_status == 'NOT_ACTIVE') { $live_button = __('Closed', 'event_espresso'); $cart_link = ''; break; } That will break out of the for each loop for that single event when it is not an active event, we are breaking out before any output is made to the browser for that event. Does that help? |
|
The support post ‘Event_list and Event_custom_view show different query results for same parameter’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.