3

I've got a entry called "town" with a native relationship field, the field name is "parks" and it relates to a channel of entries of parks! Each "Park" has a category too.

In my template i'm showing my "Town" entry and i want to display the related "park" and it's category.

But, i don't seem to be having much luck with it.

My code is as follows:

{exp:channel:entries dynamic="off"}
{parks}{categories}{category_name}{/categories}{/parks}
{/exp:channel:entries}

But i've also tried:

{parents field="parks"}{categories}{category_name}{/categories}{/parents}

I'm sure i'm just being a cretin here, any help would be lovely, cheers :)

4

You need to prefix the categories loop with the related field name like this:

{exp:channel:entries dynamic="no"}
    {parks}{parks:categories}{category_name}{/parks:categories}{/parks}
{/exp:channel:entries}

This is to allow you flexibility to display the parent entry's categories too, so it's quite handy.

1
  • Awesome, just bloody awesome :) Nov 27 '13 at 13:35

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.