I'm posting this question again as have had no reply and I think it's a pretty important one.
I'm wanting to display lists of events with certain tags. Have followed instructions here and here but am unable to get this to work. Here is what I have:
An event set up with the tag 'fossilfools'.
A custom html file called '_fossilfools_events.html' with the following code:
<ul class="event-wrap">
{% for event in tag.events_upcoming %}
<li>{% include "event" %}</li>
{% endfor %}
</ul>
I've then included the following liquid code in the template of the page where I want to display all events that have the tag 'fossilfools':
{% tag "fossilfools" with "fossilfools_events" %}
Nothing is displaying. What I am doing wrong? I can only think that the theme object reference of 'events_upcoming' is the problem and needs to be substituted with a different theme object reference in order to work with tags. But there doesn't seem to be any info about this.
There is some discussion of trying to do this here, but with no answer.
Andrew was able to resolve this issue:
The reason it is not working is because tag does not have the page variable “events_upcoming.” See all tag page variables here:
http://nationbuilder.com/page_tag_variables
The first example, for calendar pages, does work because “events_upcoming” is a calendar page variable:
http://nationbuilder.com/calendar_page_variables
We recommend for the {% for event in tag.events_upcoming } you actually use: { for event in tag.most_recent_published_pages %}
This works :)
------
See the comments for more details.
Showing 4 reactions
Sign in with
The reason it is not working is because tag does not have the page variable “events_upcoming.” See all tag page variables here:
http://nationbuilder.com/page_tag_variables
The first example, for calendar pages, does work because “events_upcoming” is a calendar page variable:
http://nationbuilder.com/calendar_page_variables
We recommend for the {% for event in tag.events_upcoming } you actually use: { for event in tag.most_recent_published_pages %}
This works :)
Instead of {% for post in tag.most_recent_published_pages }, had put { for event in tag.events_upcoming %} in html file “xx”.
That should pull all the events, and then the {% tag “fossilfools” with “xx” %} in the template should pull out just the events with the tag “fossilfools”.
But it does nothing. And I can’t see why. Mmmm….
<ul class=“event-wrap”>
{% for event in page.calendar.events_upcoming }
{ if event.tag.name == “fossilfools” }
<li>{ include “event” }</li>
{ endif }
{ endfor %}
</ul>
with {% subpage “events” with “fossilfools_events” %}
in the template, but this just displays all events. It’s not choosing only the events with the tag “fossilfools”.
Thought
event.tag_name might work, but no go there either.
Can’t find the right format for that object reference that identifies the name of the tag of the event. And I’ve tried quite a few options! Anybody know?