Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
stash events filtered by day of the week
{!-- Controller --}
{exp:channel:entries channel="events" dynamic="off" show_future_entries="yes" order_by="entry_date" sort="asc" }
{!-- match wed --}
{exp:stash:append_list name="events_wed" match="#Wed#" against="{entry_date format='%D'}" }
{stash:entry}
<li><a href="{page_url}">{title}</a> {entry_date format="%d/%m/%y"}</li>
{/stash:entry}
{/exp:stash:append_list}
{!-- match fri --}
{exp:stash:append_list name="events_fri" match="#Fri#" against="{entry_date format='%D'}" }
{stash:entry}
<li><a href="{page_url}">{title}</a> {entry_date format="%d/%m/%y"}</li>
{/stash:entry}
{/exp:stash:append_list}
{!-- match sat --}
{exp:stash:append_list name="events_sat" match="#Sat#" against="{entry_date format='%D'}" }
{stash:entry}
<li><a href="{page_url}">{title}</a> {entry_date format="%d/%m/%y"}</li>
{/stash:entry}
{/exp:stash:append_list}
{/exp:channel:entries}
{!-- View --}
<h1>Prioritise the first event for each day for this week</h1>
<h2>Wednesday</h2>
{exp:stash:get_list name="events_wed" limit="1"}
{entry}
{/exp:stash:get_list}
<h2>Friday</h2>
{exp:stash:get_list name="events_fri" limit="1"}
{entry}
{/exp:stash:get_list}
<h2>Saturday</h2>
{exp:stash:get_list name="events_sat" limit="1"}
{entry}
{/exp:stash:get_list}
<hr/>
<h1>Show less information for the weeks coming</h1>
<h2>Wed</h2>
<ul>
{exp:stash:get_list name="events_wed" offset="1"}
{entry}
{/exp:stash:get_list}
</ul>
<h2>Fri</h2>
<ul>
{exp:stash:get_list name="events_fri" offset="1"}
{entry}
{/exp:stash:get_list}
</ul>
<h2>Sat</h2>
<ul>
{exp:stash:get_list name="events_sat" offset="1"}
{entry}
{/exp:stash:get_list}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.