BEFORE and AFTER

Provides the ability to run a opening block in your template that will be output BEFORE and AFTER the loop.

Overview

The [before] and [after] Template tag blocks are used to output a piece in your template that will only be output before the ‘loop’ portion of the template and after it. This is primarily used for Table heading blocks <table><thead>...</thead><tbody> (and table ending blocks </tbody></table>) and the opening Un-ordered List <ul> and closing un-ordered list </ul>. NOTE: Magic Tags are not processed inside the Before and After blocks, so they cannot be used to provide ‘totals’ or ‘counts’ or anything else of that nature.

Usage

You also have access to [before] and [after] blocks. These can be used to set code that runs before or after all iterations of a template. This means that if you call a template in a against a loop or using the Pods shortcode, so that it is used to show multiple items, the [before] and [after] blocks will only run once.

This avoids the issue where the shortcode

[pods name="books" template="Books - List"]

If it called a template like this:

<ul>
    <li>{@post_title}</li>
</ul>

Would output:

<ul>
    <li>Book One</li>
</ul>
<ul>
    <li>Book Two</li>
</ul>
<ul>
    <li>Book Three</li>
</ul>

That template could be rewritten as:

[before]<ul>[/before]
    <li>{@post_title}</li>
[after]</ul>[/after]

Which will result in:

<ul>
     <li>Book One</li>
     <li>Book Two</li>
     <li>Book Three</li>
</ul>

Other Helpful Documentation on Template Tags

EACH Loop Tag

Provides easy looping through related entries (from relationship fields), taxonomies and media upload fields within Pods Templates.

Example Template Tag Usage

Examples of Pods Templates using a mixture of tags

IF/ELSE Conditional Tag

Provides simple conditional logic for your Pods Templates

ONCE Template Tag

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