1

Is there any way to return the playa field's name (or an ID / short name / anything similar) within a playa loop? I basically need to pull two different playa fields, but treat them differently.

Readability-wise, I'd love to keep this as a single playa loop, but that isn't strictly necessary and might be my backup plan.

Ideally, I'm looking for something like:

{exp:playa:children field="missed|content" status="open" limit="10"}
  {if field == "missed"}
    display missed field one way
  {if:elseif field == "content"}
    display content field a different way
  {if:else}
    ...
  {/if}
{/exp:playa:children}

I'm hoping I'm just not seeing something. Thank you!

1 Answer 1

0

Can you check for the presence of a field or a status that's present in one type of entry, but not the other? For instance, if you're pulling from two separate channels, you could do something like this...

{if some_var_in_channel_1}
   ...
{if:elseif some_Var_in_channel_2}
  ...
{/if}

If it's channel based, could also use {channel_short_name} to compare against.

3
  • Unfortunately, this didn't work. The playa fields are set to pull in the exact same grouping of entries (same channel, cats, statuses, etc). Sep 16, 2015 at 17:03
  • I'd suggest you just use a Playa loop for each field then as you suggest in your post. Sep 16, 2015 at 18:19
  • Yeah, that does seem like the best answer right now. Thank you! Sep 16, 2015 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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