I'm working on an WordPress Archive (using Views) for a table of events for a festival. I have a basic version of it working:
[wpv-layout-start] [wpv-items-found] <!-- wpv-loop-start --> <table width="100%"> <thead><tr> <th class="events-heading events-datetime">[wpv-heading name="types-field-start-time"]Start Time[/wpv-heading]</th> <th class="events-heading">[wpv-heading name="post-link"]Title with a link[/wpv-heading]</th> <th class="events-heading">[wpv-heading name="wpv-post-taxonomy"]CIF Artistic Categories[/wpv-heading]</th> <th class="events-heading">[wpv-heading name="wpv-post-taxonomy"]CIF Event Types[/wpv-heading]</th> <th class="events-heading">[wpv-heading name="types-field-price"]Price[/wpv-heading]</th> <th class="events-heading"></th> </tr></thead> <tbody> <wpv-loop> <tr> <td class="events-table events-datetime">[types field="start-time" id="" format="D, M jS @ g:i A"][/types]</td> <td class="events-table">[wpv-post-link]</td> <td class="events-table">[wpv-post-taxonomy type="cif-artistic-categories" separator=", " format="link" show="name"]</td> <td class="events-table">[wpv-post-taxonomy type="cif-event-types" separator=", " format="link" show="name"]</td> <td class="events-table">[types field="price" id=""][/types]</td> <td class="events-table">[types field="featured" id=""][/types]</td> </tr> </wpv-loop> </tbody> </table> <!-- wpv-loop-end --> [/wpv-items-found] [wpv-no-items-found] [wpml-string context="wpv-views"]<strong>No posts found</strong>[/wpml-string] [/wpv-no-items-found] [wpv-layout-end]
What I would like is to break it into sections by day. So there before the row for first show on Monday, March 31st, there would be a row in the table which only had "Monday, March 31st" and then I would only have to display the time in the time column below. Then before the first show on Tuesday appeared, there would be a similar row.
Conceptually, I would do this by setting a variable to the value of the first event's Day and Date, and make a row for it, just displaying that. Then each time going through the loop, it would check to see if the Day and Date have changed since the previous loop and add a row for the new day, if it changed.
Here are my questions:
– How can I set a variable outside of a [wpv-if] shortcode?
– Can I set a variable to just the Day/Date portion of a date-time argument?
– Is that variable persistent between iterations of <wpv-loop>?
– Can I see an example of using a [wpv-if] using a variable not set within that shortcode?