ONCE Template Tag

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

DEPRECATED – DO NOT USE

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]
    <h3>Chapters</h3>
    <ul>
    [each chapters]
        <li [once] class="first-chapter"[/once]>{@post_title}</li>
    [/each]
    </ul>
[else]
    <p>Sorry, No chapters</p>
[/if]