Contents
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
- 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]
- To loop through Relationship fields, Taxonomy terms or Multiple image/media fields, use
[each related_field_name][/each]
. Remember don’t include therelated_field_name
in front of any magic tags inside the each loop. - To limit output in template to only the beginning of output (like for
ul
,ol
ortable
heads) use[before][/before]
and subsequently[after][/after]
at the ending portion.
EACH Loop Tag
Provides easy looping through related entries (from relationship fields), taxonomies and media upload fields within Pods Templates.
IF Conditional Tag
Provides simple conditional logic for your Pods Templates
BEFORE and AFTER
Provides the ability to run a opening block in your template that will be output BEFORE and AFTER the loop.
ONCE Template Tag
DO NOT USE. This Tag has been deprecated. Use CSS with nth positioning :first if you need this functionality.
Example Template Tag Usage
Examples of Pods Templates using a mixture of tags