I have a field named {the_shadow} set up with P&T Switch field type of "yes" and "no" for their values. For some reason it doesn't seem to work:

    {if main_photo}
    <!-- Work -->
        <li class="touchcarousel-item">          
            <div class="workPiece">{exp:gwcode_fileinfo:single file="{main_photo}"}<img src="{main_photo}" width="{image_width}" height="505" alt="{title}" />{/exp:gwcode_fileinfo:single}</div>
            {if the_shadow == "yes"}<div class="workShadow">&nbsp;</div>{/if}


I am running ee v.2.5.5.

Thanks, -Sam

  • Can you be a bit more specific about what doesn't work? What have you tried so far? For more details about what to include in your question, see our FAQ. Mar 11, 2013 at 15:31

1 Answer 1


Try something like this. You'll see that pt_switch actually outputs 'y' not 'yes'. :) If you're having trouble with conditionals. always echo out your variables so you can see what you need to test against. :)

    {exp:channel:entries channel="pt_test_channel"}
    {if pt_switch == 'y'}


So in your case you need this line:

{if the_shadow == "y"}<div class="workShadow">&nbsp;</div>{/if}
  • Thanks, Lisa. I did a test above and it works. The weird thing is when it won't work when it's set to default yes but once it's been toggled, then it works. On the test channel it works for both though. I'm just glad it's working. Thanks again.
    – Jonah Vo
    Mar 11, 2013 at 22:20
  • Hrm, you have to toggle it to register? Can you make sure you're running the version from GitHub? github.com/pixelandtonic/pt_switch Thank you!
    – Lisa
    Mar 11, 2013 at 22:27

Your Answer

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

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