1

I have two channel types section namely "Services" and "Cases". I have added caseServices as entry field in cases. I can get services of a case in twig as entry.caseServices. But how can i get cases where a particular service used to show on service page ?

Image preview

1 Answer 1

2

You can do an entry query with the type parameter:

https://craftcms.com/docs/3.x/entries.html#type

{% set entries = craft.entries().section('channelName').type('typeName').all() %}

Or expressed without chaining and possibly better readability without having new lines for each parameter.

{% set entries = craft.entries({
    section: 'channelName',
    type: 'typeName'
}).all() %}
1
  • Let suppose i have a case named "Case 1" in which i can select "service 1" and "service 2", which are services entries. I can get these services on "case 1" details page but how i can get "case 1" when i go to "service 1" or "service 2" page ? Please reply i need it as soon as possible. I can guess it will be done using relatedTo but im not able to create such element query in twig file. Aug 4 at 11:25

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.