0

I'm really struggling to output a parent field value within a Playa tag pair. I've had to resort to using php in my template to do this. Is there a way I can do this without using php in my template? Thanks.

I had to enable php and do this:

<?php $parent_field = {parent_field} ?>
{playa_field}
    <a href="{url_title}">{title} <?php echo $parent_field ?></a>
{/playa_field}

As this doesn't output the {parent_field} content within the tag pair:

{playa_field}
    <a href="{url_title}">{title} {parent_field}</a>
{/playa_field}
1

Wouldn't you just need to use the playa:parents tag pair instead of the fieldtype tag pair?

0

I ended up prefixing the Playa fields. The following code allows you to access parent field/s.

{playa_field var_prefix="pl"}
    <a href="{pl:url_title}">{pl:title} {parent_field}</a>
{/playa_field}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.