5

Is there a way to get the total number of items chosen in a multiple relationships field?

1
  • 3
    Grrr EE Docs are missing, and inconsistent! Commented Aug 11, 2014 at 5:55

2 Answers 2

10

Did you try this tag:

{relationship_field:total_results}

Example:

{exp:channel:entries channel="xyz"}
        {relationship_field}
           {relationship_field:total_results}
        {/relationship_field}
{/exp:channel:entries}
1
  • Yup. That is what I need. Commented Sep 9, 2013 at 6:15
3

In addition to Bhashkar Yadav's answer, this worked successfully for me:

{exp:channel:entries channel='channel_xyz' status='not closed'}
    {if relationship_field:total_results > 0}
        ...do something!
    {/if}
{/exp:channel:entries}

...that is, having it outside of the relationship field loop.

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.