<p>You can find info about how to do this in the docs: <a href="https://calendars.docs.topshelfcraft.com/guide/events-variable.html#How-it-Works" rel="nofollow noreferrer">https://calendars.docs.topshelfcraft.com/guide/events-variable.html#How-it-Works</a></p>

<p>The <em>EventCriteriaModel</em> given by <code>craft.calendars.events</code> is used to query the owner elements from which the event instances are generated.</p>

<p>So, in your example above, you can use something like:</p>

<pre><code>{% set params = {
    calendar: 'myAwesomeCalendar',
    dateRangeStart: 'today',
    dateRangeEnd: now|date_modify("+1 month"),
    trainingType: 'webinar',
    trainingLevel: 'expert' 
} %}
</code></pre>

<p>This tells <em>Calendars</em>:</p>

<ul>
<li>Find entries where <code>trainingType</code> is "webinar" and <code>trainingLevel</code> is "expert"...</li>
<li>...and if those elements have any event rules registered on the Calendar called <em>myAwesomeCalendar</em>...</li>
<li>...return the instances of those events that occur in the next month.</li>
</ul>

<p>(In this case, <em>Calendars</em> queries Entry elements, since that is the default. You could specify a different element type, however.)</p>

CC BY-SA 3.0
2017-01-23T15:40:26.830Z
2017-01-23T15:40:26.830Z
Michael Rog
<p>I'm using Michael Rog's <a href="https://calendars.docs.topshelfcraft.com" rel="nofollow noreferrer"><em>Craft Calendars</em></a> plugin.</p>

<p>I'm wondering if it's possible to limit events to specified owner category.</p>

<p>For example, I have a training entry with <em>trainingType</em> and <em>trainingLevel</em> category type fields.</p>

<p>While listing events is it possible to do something like:</p>

<pre><code>{% set params = {
    calendar: 'myAwesomeCalendar',
    dateRangeStart: 'today',
    dateRangeEnd: now|date_modify("+1 month"),
    owner.trainingType = 'webinar',
    owner.trainingLevel = 'expert' 
} %}

{% for e in craft.calendars.events(params) %}
    &lt;h1&gt;{{ e.owner.title }}&lt;/h1&gt;
    &lt;p&gt;Starts: {{ e.startDate  | date("Y-m-d") }}&lt;/p&gt;
    &lt;p&gt;{{ e.owner.trainingType }} , {{ e.owner.trainingLevel }}
{% endfor %}
</code></pre>

<p>If not, how else would you approach this.</p>

<calendar><plugin-calendar>
Filter events by owner fields - Calendar plugin
# Filter events by owner fields - Calendar plugin

(Asked by: username_0 on 2017-01-21)

I'm using Michael Rog's Craft Calendars plugin.
I'm wondering if it's possible to limit events to specified owner category.
For example, I have a training entry with trainingType and trainingLevel category type fields.
While listing events is it possible to do something like:
{% set params = {
    calendar: 'myAwesomeCalendar',
    dateRangeStart: 'today',
    dateRangeEnd: now|date_modify("+1 month"),
    owner.trainingType = 'webinar',
    owner.trainingLevel = 'expert' 
} %}

{% for e in craft.calendars.events(params) %}
    {{ e.owner.title }}
    Starts: {{ e.startDate  | date("Y-m-d") }}
    {{ e.owner.trainingType }} , {{ e.owner.trainingLevel }}
{% endfor %}

If not, how else would you approach this.

**Tags:** calendar, plugin-calendar

---

## 1 answers

### Answer by username_1 on 2017-01-23. Score: 1 | Accepted answer

You can find info about how to do this in the docs: https://calendars.docs.topshelfcraft.com/guide/events-variable.html#How-it-Works
The EventCriteriaModel given by craft.calendars.events is used to query the owner elements from which the event instances are generated.
So, in your example above, you can use something like:
{% set params = {
    calendar: 'myAwesomeCalendar',
    dateRangeStart: 'today',
    dateRangeEnd: now|date_modify("+1 month"),
    trainingType: 'webinar',
    trainingLevel: 'expert' 
} %}

This tells Calendars:

Find entries where trainingType is "webinar" and trainingLevel is "expert"...
...and if those elements have any event rules registered on the Calendar called myAwesomeCalendar...
...return the instances of those events that occur in the next month.

(In this case, Calendars queries Entry elements, since that is the default. You could specify a different element type, however.)


---

