0

Maybe I'm just completely missing something, but I've looked through the docs a few times and haven't been able to find an answer. I'm working on building a way for people to go through events and filter them by day and time. Is there a way in Calendar to filter events by day? I haven't been able to find anything about it.

For example, I'd really like to be able to simply put something along the lines of:

{exp:calendar:cal day="thur"}

to only display events that occur on Thursdays. But so far, I haven't been able to find anything along those lines and I'd rather stay away from doing a somewhat complicated if statement. Especially with the number of filters I'm creating. I'm also using some query strings to filter, but I assume that wouldn't be an issue if I can just figure out how to filter events by day.

0

There isn't a simple parameter for this. You must provide a time window for {exp:calendar:cal}, then filter for your day using a conditional. Here's a simple example for getting all events on Thursday for the current month:

{exp:calendar:cal
   date_range_start="year-month-01"
   date_range_end="year-month-last"
   pad_short_weeks="n"}
   {events}
      {if '{event_start_date format="%l"}' == "Thursday"}
         // Your event data
      {/if}
   {/events}
{/exp:calendar:cal}

Of course, in a different scenario, if you have a specific date and want to "zoom in" on that date (eg. Jan 30th, which was a Thursday), you can also set date_range_start="" and date_range_end="" on the same date to display only events on that day:

{exp:calendar:cal
   date_range_start="2014-01-30"
   date_range_end="2014-01-30"
   pad_short_weeks="n"}
   {events}
      // Your event data
   {/events}
{/exp:calendar:cal}

You can use also URI segments to determine what is used in the date_range_start="" and date_range_end="" parameters.

The pad_short_weeks="n" parameter is also important to avoid including all days from a full week row.

2
  • Thanks for the answer. I'll use that method. Is that something the could possibly be included in a future version? Or is that something that's not really in the picture?
    – Andrew
    Feb 1 '14 at 0:27
  • The functionality is already there, so it's unlikely a feature doing the same would be added anytime in the near/medium future.
    – Solspace
    Feb 4 '14 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.