Template Tags

Special handling for conditional output or looping through relationships, taxonomy or attached media.

Overview

To make working with Pods Templates easier, we’ve made several Conditional tags available to make it easier to create the output you’re looking for in your Pods Templates. As PHP is deprecated in Pods Templates as of Pods 2.4, the focus was to provide some Advanced Markup options using conditional tags. These new tags are defined below and provide utility for expanding relationship fields and conditionally showing content.

Quick Start

  1. To see if a field is present or not and output conditional content on whether it has a value, use [if field_name][else][/if]
  2. To loop through Relationship fields, Taxonomy terms or Multiple image/media fields, use [each related_field_name][/each]. Remember don’t include the related_field_name in front of any magic tags inside the each loop.
  3. To limit output in template to only the beginning of output (like for ul, ol or table heads) use [before][/before] and subsequently [after][/after] at the ending portion.

More Documentation on Template Tags

BEFORE and AFTER

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

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.