0

I have a section called Services. I have another section called Case Studies.

For each Case Study I want to show which service is being used so I add an entry field and choose the right service. On my case study I can see that the service is showing as it should.

On the Service page I want to see which case studies are being associated with the Service.

2
  • Can you expand your question slightly to explain what you are viewing and what you are trying to show? It sounds like you're trying to show a field from one entry on another entry's page? You also mention that you are already showing A on X? Commented Jun 13, 2016 at 8:59
  • Ok, say I have a section called Services. I have another section called Case Studies. For each Case Study I want to show which service is being used so I add an entry field and choose the right service. On my case study I can see that the service is showing as it should. All good til there. But I want that on the Service page I can see which case studies are being associated with this Service. Commented Jun 13, 2016 at 9:01

1 Answer 1

2

So your Case Study has a field called services which is an entry relation. You show the services on that Case Study page using

// entry is the current Case Study
{% set related_services = craft.entries.section( 'services' ).relatedTo( entry ) %}

To show all Case Studies that are related to a Service you can use the same entries query.

// entry is the current Service
{% set related_case_studies = craft.entries.section( 'caseStudies' ).relatedTo( entry ) %}

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.