Template Tags and Parameters
Playa comes with five powerful template tags, each with a host of parameters to filter, order, and sort your related entries.
Primary Tag Pair
To fully customize your Playa field’s output, use its primary tag pair:
<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}
Single Variable Tags
The following single variables are available within your tag pair:
{count}
- The current entry’s position within the entries being displayed
{total_related_entries}
- The total number of entries being displayed
{switch}
- Switch between multiple values based on the current entry’s position
:ol
and :ul
Tags
Returns an ordered/unordered list of each of your related entries’ titles.
<h4>Favorite Bands</h4>
{favorite_bands:ol show_expired="yes"}
:entry_ids
Tag
Returns a list of the related entry IDs.
{embed="site/related_entries" entry_ids="{favorite_bands:entry_ids}"}
:entry_ids
Tag Parameters
Beyond the full assortment of Playa’s tag parameters, the :entry_ids
tag accepts one additional parameter:
delimiter=", "
- String used to separate the returned entry IDs (default is “|”).
Tag Parameters
Each of Playa’s tags will accept the following parameters:
author_id="1|2|3"
- Only show entries by certain authors. Prefix with “not” to specify which authors to exclude.
group_id="1|2|3"
- Only show entries by authors within certain member groups. Prefix with “not” to specify which member groups to exclude.
category="1|2|3"
- Only show entries in certain categories. Prefix with “not” to specify which categories to exclude.
category_group="1|2|3"
- Only show entries from channels assigned to certain category groups. Prefix with “not” to specify which category groups to exclude.
entry_id="1|2|3"
- Only show entries with certain entry IDs. Prefix with “not” to specify which entry IDs to exclude.
status="open|closed"
- Only show entries with certain statuses. Prefix with “not” to specify which statuses to exclude. (Default is “not closed” as of Playa 2.1)
url_title="lorem|ipsum"
- Only show entries with certain URL titles. Prefix with “not” to specify which statuses to exclude.
channel="lorem|ipsum"
- Only show entries within certain channels. Prefix with “not” to specify which channels to exclude.
show_expired="yes"
- Include expired entries (default is “no” as of Playa 2.1).
show_future_entries="yes"
- Include entries whose entry date is set in the future. (default is “no” as of Playa 2.1)
orderby="entry_date|title"
- Override the author-defined order. This can be set to any of the columns in the
exp_channel_titles
table (entry_id, site_id, channel_id, author_id, etc.).
fixed_order="1|2|3"
- Override the author-defined order with pipe-delimited entry IDs. Note that, like
{exp:channel:entries}
’ counterpart, using this parameter will automatically exclude all selected entries that are not in this list.
sort="asc|desc|random"
- Specify whether entries should be listed in ascending, descending, or random order. This will take effect regardless of whether you’re sticking with the author-defined order, or overriding it with
orderby
or fixed_order
.
offset="2"
- Skip the first X entries.
limit="5"
- Only show X entries.
backspace="2"
- Strip the last X characters from the tag output.
dynamic_parameters="offset|limit"
- Set specific tag parameters “on the fly” using POST data submitted via a form. Mimics the parameter for
{exp:channel:entries}
.