ONCE Template Tag

DO NOT USE. This Tag has been deprecated. Use CSS with nth positioning :first if you need this functionality.


This tag has never worked as intended or as described in this overview. If you want something to only show up on the 1st item in a loop, use nth positioning with CSS, the :first indicator.


Old Documentation: Usage

In many cases when doing an each loop, you may need to add markup, on the first item only. For example to apply a special CSS style or to add an “active” class for jQuery sliders, accordions or tabs. Adding to our chapters example, this next example adds a “first-chapter” class to the first chapter only:

[if chapters]
    [each chapters]
        <li [once] class="first-chapter"[/once]>{@post_title}</li>
    <p>Sorry, No chapters</p>