CODE

Hide Event List Item when Full

This Liquid code will hide your Event item in the list view if its capacity is full AND it’s marked as ‘Hide When Full’.

v1.0.0
  1. By default, Treepl will block access to an Event’s detail page if it is full AND has been marked as ‘Hide When Full’. However, it will not hide the Event from any list views you may have.

    This code helps solve this problem and optionally, allows you to show a “Full” label against Event list items that are full but NOT marked as ‘Hide When Full’.

    Place the below code into your Event list layout and replace the makeup with your own.

    <!-- Treehouse CODE v1.0.0 -->
    {% if this.capacity == 0 or this.allocation < this.capacity or this.HideWhenFull == false %}
    <!-- YOUR EVENT LIST MARKUP HERE, eg: -->
    <div>
        <!-- OPTIONAL: Show "Full" label -->
        {% if this.capacity != 0 and this.allocation >= this.capacity %}
        <div class="label">Full</div>
        {% endif %}
        <h2><a href="{{this.Url}}">{{this.Name}}</a></h2>
    </div>
    {% endif %}

Comments or questions? Head over to the Treepl CMS forum to discuss with the community.