{exp:playa:coparents}¶
You can use the {exp:playa:coparents} tag pair to loop through entries that share a common child with other entries.
{exp:channel:entries}
<h3>Similar entries to “{title}”</h3>
<ul>
{exp:playa:coparents}
<li><a href="{path={channel_short_name}/{url_title}}">{title}</a></li>
{/exp:playa:coparents}
</ul>
{/exp:channel:entries}
Tag Parameters¶
{exp:playa:coparents} supports almost all of {exp:channel:entries}’ tag parameters, as well as the following:
- entry_id
- The main entry’s ID(s). If your tag is within an {exp:channel:entries} tag pair, this will default to the current entry’s ID.
- coparent_id
- The co-parent entry ID(s) to include. Prefix with “not ” to define entries to exclude instead.
- child_id
- The child entry ID(s) that the co-parents must have in common. Prefix with “not ” to define entries to exclude instead.
- field
- The Playa field’s name where the relationships were 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 relationships were made, or the Matrix field’s ID if your Playa field lives within a Matrix field.
- col
- The Matrix column’s name where the relationships were made.
- col_id
- The Matrix column’s ID where the relationships were made.
- row_id
- The Matrix row’s ID where the relationships were made.
- var_prefix
- Tells Playa to only parse variables that have a certain prefix. This is handy when you’re dealing with variable name conflicts, such as if you’re pulling in an entry with its own Playa tag.
Note: By default, co-parents will be ordered by the number of common children they share with the original entry. You can override that with the orderby param.
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:coparents} supports almost all of {exp:channel:entries}’ conditional variables, single variables, and variable pairs, as well as the following:
- {if no_coparents} … {/if}
- Outputs the contents only when there are no co-parent entries returned.