I have a multi-site with two different channels:

  1. Guides
  2. Rivers

I need to associate specific guides with each river. Each river can have multiple guides associated with them.

Currently, I have it setup so the Rivers have a relationship field that allows selecting of entries from guides channel. That's working perfectly, but I'm running into an issue trying to list all of the Rivers a Guide is associated with.

For example: I have the river Salmon with a relationship of Guide A, Guide B and Guide C. On the Salmon River's page, it displays Guide A, Guide B and Guide C.

When I click on Guide A, I want that page to display all of the Rivers that have Guide A selected in the River's relationship field, i.e. Salmon River, Main Payette, etc.


You need to use a reverse relationship tag {parents}, it's well documented (with a Pizza Shop example) here on the EE docs site : https://ellislab.com/expressionengine/user-guide/add-ons/channel/relationships.html#parent-entries-which-stores-have-which-pizza

For example :

{!-- assuming here the guide being displayed is entry ID of 1 --}
{exp:channel:entries channel="guides" entry_id="1"}

    <h2>Guide : {title}</h2>

    <p>Rivers this guide applies to:</p>

    {!-- Here, the field parameter needs to be the field id of the relationship field on the rivers channel --}
    {parents field="river_guides"}

And yes this is a duplicate. Let us know how you get on though please.

Also, you don't actually mention if your relationship fields are in a grid or matrix, are they? If so this answer might be of use to you : Parent relationship in grid field type

  • Thank you for replying and for the example. It's still not working in the way I intended, but I think it's because of my relationship scheme. I'm going to switch my relationship so Guides is the parent and Rivers is the child. – Wes Apr 23 '15 at 17:10
  • Before you get yourself into refactoring hell, please see the answer I just posted here : expressionengine.stackexchange.com/questions/18888/… (its a stale topic, but unanswered and applicable). It does sound alot like you've got your relationships inside a Grid, in which case this answer will get you out of stum! – Blatant Apr 23 '15 at 17:18
  • Of course if you have multi-select enabled on your relationship field it's not the 100% solution, but the technique (which I tried to fully explain so you can read along) might still prove useful, essentually it's a "sod EE, I'll get mthe parents myself, dammit!" approach :D – Blatant Apr 23 '15 at 17:31
  • Thanks, i'll check that out. My relationship is not to a grid though and I do have multi select checked. I ended up changing the relationship around so Guides is the parent an Rivers are the children. – Wes Apr 23 '15 at 23:02

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