Skip to main content

Display a list of events with a particular tag

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.

Official response from

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.

Share this post

Showing 4 reactions

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.