I want to insert a simple exception, using an "if" statement, into the flow of my Playa field's output. But it's not working. Can I get help?

Here's the code that works:

{prac_area_contact_people backspace="3"}
<a href="/people/bios/{url_title}"><nobr>{exp:tagstripper:stripAllTags}{people_first_name} {person_last_name}{/exp:tagstripper:stripAllTags}</nobr></a>, 

prac_area_contact_people is the name of my Playa field.

I want to add some content to the end of the anchor tag in the 2nd line of the sample above, ONLY when the person_last_name field is equal to a certain value.

So I did this:

<a href="/people/bios/{url_title}/{if person_last_name == 'pollack'}professional_liability{/if}">

The goal is that when the person_last_name field is pollack it adds on the extra segment in the URL. But the thing fails. What am I doing wrong?

  • You're using people for the first name, but person for the last name - is that intentional, or a typo (and it that your problem)? Jan 31, 2014 at 20:48
  • The field names for people_first_name and person_last_name are correct. Just inconsistent. Jan 31, 2014 at 20:58
  • I fixed the problem that was preventing my code from showing up up where it says "So I did this..." It shows now! Jan 31, 2014 at 20:58

2 Answers 2


That should work as you have it, unless something else is parsing the conditional before Playa can get to it. Try using Playa’s var_prefix param to prevent that:

{prac_area_contact_people backspace="3" var_prefix="person"}
    <a href="/people/bios/{person:url_title}{person:if person_last_name == 'pollack'}/professional_liability{/person:if}">
        <nobr>{exp:tagstripper:stripAllTags}{person:people_first_name} {person_last_name}{/exp:tagstripper:stripAllTags}</nobr>
  • Brandon, it doesn't work. How about if I change my approach, but excluding a single entry using the conditional in the following playa tag. I can just hard-code in the item I want at the end of the playa output. See here: {prac_area_contact_people backspace="3" {if segment_2 == 'professional_liability'}entry_id="not 859"{/if}} <a href="/people/bios/{url_title}"><nobr>{exp:tagstripper:stripAllTags}{people_first_name} {person_last_name}{/exp:tagstripper:stripAllTags}</nobr></a>, {/prac_area_contact_people} {/exp:channel:entries} But I tried this and entry 859 still shows in playa output. Jan 31, 2014 at 21:31
  • ugh. the comments don't preserve my line breaks. Jan 31, 2014 at 21:33
  • this is the line that I can't get to work, the if statement inside the playa tag. when i am on the page that has the segment 2 that it mentions, entry 859 is not excluded. {prac_area_contact_people backspace="3" {if segment_2 == 'professional_liability'}entry_id="not 859"{/if}} Jan 31, 2014 at 21:35
  • Question withdrawn. I found a different strategy since this wasn't working. Thanks to those who lent a hand. I think I hate EE. Jan 31, 2014 at 23:00

The conditional you are looking for is as follow. You have to parse the variable into a string because of the parse order of the playa field.

{if "{prac_area_contact_people}" == "pollack"} Content {/if}

That should work.

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.