0

I'm trying to list category entries from relationship entry: I'm trying to achieve this result:

          CategoryA
          test1

          CategoryB
          test2
          test3

but my attempt:

    {relationship_field}
      {relationship_field:categories backspace="2"}
        {if parent_id !="0"}
          {category_name}
          {relationship_field:title}
        {/if}
      {/relationship_field:categories}
    {/relationship_field}

shows this result:

          CategoryA
          test1

          CategoryB
          test2

          CategoryB
          test3
0

Haven't got a system to test on - but looks like you need to explicitly loop the values that have the category. I suspect you need to use the 'siblings' tag - something like:

{relationship_field}
  {relationship_field:categories backspace="2"}
    {if parent_id !="0"}
      {category_name}
      {relationship_field:siblings field="relationship_field"}
            {relationship_field:siblings:title}
      {/siblings}
      {relationship_field:title}
    {/if}
  {/relationship_field:categories}
{/relationship_field}

HTH

| improve this answer | |
  • closing tag should be: {/relationship_field:siblings} anyway ended up using embed template – simpleton Oct 27 '16 at 19:51

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.