0

In the below I need the field {link_rhs} to display a link to any page or entry on the website. Previously we were using StructureFrame which was perfect for displaying pages, but it doesn't display all entries. Do I need the {link_rhs} field to also be a Playa field? How can a Playa field work within a Playa field? Or maybe another option?

{exp:playa:parents channel="rhs_cta" dynamic="off" entry_id='{embed:entry_id}'}
<article class="post">
    <figure>
        <a href="{link_rhs}">
            <img src="{thumbnail_image_rhs}" alt="{title}">
        </a>
        {if ribbon_title}<span class="green">{ribbon_title}</span>{/if}
    </figure>

    <div class="text">
        <h2><a href="{link_rhs}">{title}</a></h2>
        <p>{text_rhs}</p>
    </div>
    <hr class="desktop-version">
</article>
{if no_parents} 
    {embed="embeds/latest-blogs"}
{/if}
{/exp:playa:parents}
1

Sure, {link_rhs} can be a Playa field, and can be displayed inside of the playa:parents loop. Just use the standard fieldtype tag pair.

{link_rhs}
<a href="{comment_url_title_auto_path}">
    <img src="{thumbnail_image_rhs}" alt="{title}">
</a>
{/link_rhs}

I use comment_url_title_auto_path here in case you're allowing entries from multiple channels )and hnce multiple URL structures) to be selected in the Playa field.

3
  • Wow, I didn't think a tag pair would work inside another like that, especially considering it's inside a Playa field. One problem, that URL is linking to the correct page URL but not the site URL... it's missing its parent page. Any suggestions? Dec 4 '13 at 13:07
  • Yeah, playa:parents is just an extended channel:entries class, with a modified query, so if it works in channel:entries, it should work in playa:parents. Re: URL - make sure your value for Comment Page URL is correct in each channel's Path settings. Dec 4 '13 at 13:13
  • The URL was incorrect in settings. Thank you very much your answer and comments! Dec 4 '13 at 13:25

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.