Template Tags and Parameters
Playa comes with a plethora of powerful template tags, each with a host of parameters to fully customize your template output.
Template Tags at a Glance
Module Tags
{exp:playa:children}{exp:playa:parents}{exp:playa:siblings}{exp:playa:total_children}{exp:playa:total_parents}{exp:playa:total_siblings}{exp:playa:child_ids}{exp:playa:parent_ids}{exp:playa:sibling_ids}
Fieldtype Tags
Module Tags
{exp:playa:children}
Returns an entry’s children.
{exp:channel:entries channel="news"}
<h3>Article Media</h3>
<ul>
{exp:playa:children field="article_photos|article_videos"}
<li><a href="{path={channel_short_name}/{url_title}}">{title}</a></li>
{/exp:playa:children}
</ul>
{/exp:channel:entries}
Tag Parameters
{exp:playa:children} supports almost all of {exp:channel:entries}’ tag parameters, as well as the following:
entry_id=- The main entry’s ID. This parameter is required, unless used within an
{exp:channel:entries}tag pair. child_id="1|2|3"- The child entry ID(s) to include. Prefix with “
not” to define entries to exclude instead. field=- The Playa field’s name where the relationship was made, or the Matrix field’s name if your Playa field lives within a Matrix field
field_id=- The Playa field’s ID where the relationship was made, or the Matrix field’s ID if your Playa field lives within a Matrix field
col=- The Matrix column’s name where the relationship was made
col_id=- The Matrix column’s ID where the relationship was made
row_id=- The Matrix row’s ID where the relationship was made
Note: Playa sets the disable= tag parameter to “categories|category_fields|member_data|pagination” by default. So if you want to display categories, member data, or pagination tags in your Playa tag pair, you’ll need to override that parameter.
Variable Tags
{exp:playa:children} supports almost all of {exp:channel:entries}’ conditional variables, single variables, and variable pairs, as well as the following:
Conditional Variables
{if no_children} ... {/if}
Single Variables
{parent:author_id}{parent:channel_title}{parent:channel}{parent:channel_id}{parent:channel_short_name}{parent:count}{parent:entry_date}{parent:entry_id}{parent:entry_site_id}{parent:expiration_date}{parent:screen_name}{parent:status}{parent:title}{parent:url_title}
{exp:playa:parents}
Returns an entry’s parents.
{exp:channel:entries channel="photos"}
<h3>As Seen in Articles</h3>
<ul>
{exp:playa:parents channel="articles"}
<li><a href="{path={channel_short_name}/{url_title}}">{title}</a></li>
{/exp:playa:parents}
</ul>
{/exp:channel:entries}
Tag Parameters
{exp:playa:parents} supports almost all of {exp:channel:entries}’ tag parameters, as well as the following:
entry_id=- The main entry’s ID. This parameter is required, unless used within an
{exp:channel:entries}tag pair. parent_id="1|2|3"- The parent entry ID(s) to include. Prefix with “
not” to define entries to exclude instead. field=- The Playa field’s name where the relationship was made, or the Matrix field’s name if your Playa field lives within a Matrix field
field_id=- The Playa field’s ID where the relationship was made, or the Matrix field’s ID if your Playa field lives within a Matrix field
col=- The Matrix column’s name where the relationship was made
col_id=- The Matrix column’s ID where the relationship was made
row_id=- The Matrix row’s ID where the relationship was made
Note: Playa sets the disable= tag parameter to “categories|category_fields|member_data|pagination” by default. So if you want to display categories, member data, or pagination tags in your Playa tag pair, you’ll need to override that parameter.
Variable Tags
{exp:playa:parents} supports almost all of {exp:channel:entries}’ conditional variables, single variables, and variable pairs, as well as the following:
Conditional Variables
{if no_parents} ... {/if}
Single Variables
{child:author_id}{child:channel_title}{child:channel}{child:channel_id}{child:channel_short_name}{child:count}{child:entry_date}{child:entry_id}{child:entry_site_id}{child:expiration_date}{child:screen_name}{child:status}{child:title}{child:url_title}
{exp:playa:siblings}
Returns an entry’s the siblings (entries that have a common parent).
<ul class="photo-nav">
{exp:playa:siblings entry_id="{segment_3}" parent_id="{segment_2}"}
<li><a href="{path={channel_short_name}/{url_title}}">{title}</a></li>
{/exp:playa:siblings}
</ul>
Tag Parameters
{exp:playa:siblings} supports almost all of {exp:channel:entries}’ tag parameters, as well as the following:
entry_id=- The main entry’s ID. This parameter is required, unless used within an
{exp:channel:entries}tag pair. sibling_id="1|2|3"- The sibling entry ID(s) to include. Prefix with “
not” to define entries to exclude instead. parent_id="1|2|3"- The parent entry ID(s) that the siblings must have in common. Prefix with “
not” to define entries to exclude instead. field=- The Playa field’s name where the relationship was made, or the Matrix field’s name if your Playa field lives within a Matrix field
field_id=- The Playa field’s ID where the relationship was made, or the Matrix field’s ID if your Playa field lives within a Matrix field
col=- The Matrix column’s name where the relationship was made
col_id=- The Matrix column’s ID where the relationship was made
row_id=- The Matrix row’s ID where the relationship was made
Note: Playa sets the disable= tag parameter to “categories|category_fields|member_data|pagination” by default. So if you want to display categories, member data, or pagination tags in your Playa tag pair, you’ll need to override that parameter.
Variable Tags
{exp:playa:siblings} supports almost all of {exp:channel:entries}’ conditional variables, single variables, and variable pairs, as well as the following:
Conditional Variables
{if no_siblings} ... {/if}
{exp:playa:total_children}
Returns the total number of an entry’s children.
{if "{exp:playa:total_children field="article_photos|article_videos"}"}
<h3>Article Media</h3>
...
{/if}
Tag Parameters
{exp:playa:total_children} supports all of the same tag parameters as {exp:playa:children}.
{exp:playa:total_parents}
Returns the total number of an entry’s parents.
Tag Parameters
{exp:playa:total_parents} supports all of the same tag parameters as {exp:playa:parents}.
{exp:playa:total_siblings}
Returns the total number of an entry’s siblings.
Tag Parameters
{exp:playa:total_siblings} supports all of the same tag parameters as {exp:playa:siblings}.
{exp:playa:child_ids}
Returns a list of an entry’s child IDs.
{embed="includes/_showcase" entry_ids="{exp:playa:child_ids field="article_photos|article_videos"}"}
Tag Parameters
{exp:playa:child_ids} supports all of the same tag parameters as {exp:playa:children}, as well as the following:
delimiter=", "- String used to separate the returned entry IDs (default is “
|”).
{exp:playa:parent_ids}
Returns a list of an entry’s parent IDs.
Tag Parameters
{exp:playa:parent_ids} supports all of the same tag parameters as {exp:playa:parents}, as well as the following:
delimiter=", "- String used to separate the returned entry IDs (default is “
|”).
{exp:playa:sibling_ids}
Returns a list of an entry’s sibling IDs.
Tag Parameters
{exp:playa:sibling_ids} supports all of the same tag parameters as {exp:playa:siblings}, as well as the following:
delimiter=", "- String used to separate the returned entry IDs (default is “
|”).
Fieldtype Tags
The following tags apply to your individual Playa fields. They must be used within an {exp:channel:entries} tag pair. In each of the following examples, replace “favorite_bands” with your actual Playa field’s name.
Primary Tag Pair
Returns the field’s children.
<h4>Favorite Bands</h4>
{favorite_bands show_expired="yes" limit="10"}
<h4><a href="/bands/{url_title}">{title}</a></h4>
<p>{short_desc}</p>
{/favorite_bands}
Tag Parameters
The primary tag pair supports almost all of {exp:channel:entries}’ tag parameters, as well as the following:
child_ids="1|2|3"- The child entry ID(s) to include. Prefix with “
not” to define entries to exclude instead.
Note: Playa sets the disable= tag parameter to “categories|category_fields|member_data|pagination” by default. So if you want to display categories, member data, or pagination tags in your Playa tag pair, you’ll need to override that parameter.
Variable Tags
The primary tag pair supports almost all of {exp:channel:entries}’ conditional variables, single variables, and variable pairs, as well as the following:
Conditional Variables
{if no_children} ... {/if}
Single Variables
{parent:author_id}{parent:channel_title}{parent:channel}{parent:channel_id}{parent:channel_short_name}{parent:count}{parent:entry_date}{parent:entry_id}{parent:entry_site_id}{parent:expiration_date}{parent:screen_name}{parent:status}{parent:title}{parent:url_title}
:ul and :ol Tags
Returns an (un)ordered list of the field’s children’s titles.
<h4>Favorite Bands</h4>
{favorite_bands:ol show_expired="yes"}
:total_children Tag
Returns the total number of the field’s children.
<p>I have {favorite_bands:total_children show_expired="yes"} favorite bands.</p>
Note: If you’re going to use the :total_children tag in a conditional, you need to wrap the tag in quotes, e.g. {if "{favorite_bands:total_children}"}. Otherwise you’ll get a PHP parsing error if there are no selected children.
:child_ids Tag
Returns a list of the field’s children’s entry IDs.
{embed="site/child_entries" child_ids="{favorite_bands:child_ids}"}
Tag Parameters
delimiter=", "- String used to separate the returned entry IDs (default is “
|”). backspace="2"- Strip the last X characters from the tag output