Answers.Body: <p>I had a huge mess and I started all over.</p>
  
  <p>Thats the code which works:</p>
  
  <pre><code>      {# Gets the bla section #}
          {% for entry in craft.entries.section('bla') %}
            {# Gets the blog section related to bla #}
            {% set relatedBLogs = craft.entries.section('blog').relatedTo(entry) %}
            {% for entries in relatedBLogs %}
               &lt;a href="{{ entries.url }}"&gt;{{ entries.title }}&lt;/a&gt;
            {% endfor %}
          {% endfor %}
  </code></pre>
  
  <p>I thought I had to specify the entries fields but Craft determines the relational field without any declaration :O </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-27T09:33:25.370Z
Answers.LastActivityDate: 2015-01-27T09:41:02.990Z
Answers.LastEditDate: 2015-01-27T09:41:02.990Z
Answers.UserDisplayName: KSPR
Answers.Body: <p>You are correct in your assumption! Using <a href="http://buildwithcraft.com/docs/relations#the-relatedTo-param" rel="nofollow">relatedTo</a> with the associated field:</p>
  
  <pre><code>{% set entries_fields = craft.entries.section('blog').relatedTo({
      sourceElement: entry,
      field: 'fieldHandle'
  }) %}
  </code></pre>
  
  <p>Note that <code>field</code> can be the field handle of your Entries Field but it can also be a field ID.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-19T16:09:35.903Z
Answers.Text: If I enter the fieldHandle of the 'field-entries' field there is still every entry displayed. I guess I have a mess between when to trigger the blog section and when the Bla section.
Answers.UserDisplayName: KSPR
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-19T16:26:40.280Z
Answers.Text: Are you entering `field-entries` as your field handle? I'm pretty sure that field handles can't have "hyphens" in them. `field-` is something that craft prepends. Go to Settings > Fields > Field Type and find the handle of your field. This is what you should enter in the example above
Answers.UserDisplayName: Peter Tell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-19T15:46:12.910Z
Answers.LastActivityDate: 2014-12-19T15:46:12.910Z
Answers.UserDisplayName: Peter Tell
Body: <p>I want to display blog entries within the related entry template linked together with 'entries fields':</p>
  
  <pre><code>-- Entrysection Bla
  
  Blog
  -- Blog entry 1 (Linked to Entrysection Bla via 'entries fields')
  -- Blog entry 2 (no relations)
  </code></pre>
  
  <p>Now I want to display <code>Blog entry 1</code> in <code>Entrysection Bla</code></p>
  
  <pre><code>{% for entry in craft.entries.section('bla') %}
    {% for entries_fields in craft.entries.section('blog'){# related to ??? #} %}
       &lt;a href="{{ entries_fields.url }}"&gt;{{ entries_fields.title }}&lt;/a&gt;
    {% endfor %}
  {% endfor %}
  </code></pre>
  
  <p>I figured it has to be done with <code>relatedTo</code> but I cant get it done. How do I have to write this?</p>
  
  <p>-- Edit:</p>
  
  <p>Now my code on <code>Entrysection Bla</code> looks like this:</p>
  
  <pre><code>{% set entries_fields = craft.entries.section('blog').relatedTo({
     sourceElement: entry,
     field: 'blogSaisonKategorie'
  }) %}
  
  {% for xy in entries_fields %}
     &lt;a href="{{ xy.url }}"&gt;{{ xy.title }}&lt;/a&gt;
  {% endfor %}
  </code></pre>
  
  <p>That prints out nothing. No error is displayed as well.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-12-19T17:12:37.417Z
Comments.Text: In your edit, where is `entry` coming from? Are you still doing the for loop around this code? Or are you relying on `entry` to be populated by Craft in how you're pointing to this template?
Comments.UserDisplayName: Peter Tell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-12-26T14:49:26.807Z
Comments.Text: I changed `sourceElement` to `targetElement` now its bringing up all blog entries without filtering (It even shows the inactive blog entries). At least thats something. Yes I'm looping around the code. I guess my error has something to do with `targetElement: entry,`. It somehow does't listen to the fieldhandle of the `entries-fields` fiedltype.
Comments.UserDisplayName: KSPR
Tags: <relations><entries-field>
Title: Display entries based on 'entries fields'
ThreadText: # Display entries based on 'entries fields'
  
  (Asked by: username_0 on 2014-12-19)
  
  I want to display blog entries within the related entry template linked together with 'entries fields':
  
  ```
  -- Entrysection Bla
  
  Blog
  -- Blog entry 1 (Linked to Entrysection Bla via 'entries fields')
  -- Blog entry 2 (no relations)
  
  ```
  
  Now I want to display `Blog entry 1` in `Entrysection Bla`
  
  ```
  {% for entry in craft.entries.section('bla') %}
    {% for entries_fields in craft.entries.section('blog'){# related to ??? #} %}
       <a href="{{ entries_fields.url }}">{{ entries_fields.title }}</a>
    {% endfor %}
  {% endfor %}
  
  ```
  
  I figured it has to be done with `relatedTo` but I cant get it done. How do I have to write this?
  
  -- Edit:
  
  Now my code on `Entrysection Bla` looks like this:
  
  ```
  {% set entries_fields = craft.entries.section('blog').relatedTo({
     sourceElement: entry,
     field: 'blogSaisonKategorie'
  }) %}
  
  {% for xy in entries_fields %}
     <a href="{{ xy.url }}">{{ xy.title }}</a>
  {% endfor %}
  
  ```
  
  That prints out nothing. No error is displayed as well.
  
  **Tags:** relations, entries-field
  
  > **Comments:**
  > **username_1**: In your edit, where is `entry` coming from? Are you still doing the for loop around this code? Or are you relying on `entry` to be populated by Craft in how you're pointing to this template?  
  > **username_0**: I changed `sourceElement` to `targetElement` now its bringing up all blog entries without filtering (It even shows the inactive blog entries). At least thats something. Yes I'm looping around the code. I guess my error has something to do with `targetElement: entry,`. It somehow does't listen to the fieldhandle of the `entries-fields` fiedltype.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2015-01-27. Score: 1 | Accepted answer
  
  I had a huge mess and I started all over.
  
  Thats the code which works:
  
  ```
        {# Gets the bla section #}
          {% for entry in craft.entries.section('bla') %}
            {# Gets the blog section related to bla #}
            {% set relatedBLogs = craft.entries.section('blog').relatedTo(entry) %}
            {% for entries in relatedBLogs %}
               <a href="{{ entries.url }}">{{ entries.title }}</a>
            {% endfor %}
          {% endfor %}
  
  ```
  
  I thought I had to specify the entries fields but Craft determines the relational field without any declaration :O
  
  
  ---
  
  ### Answer by username_1 on 2014-12-19. Score: 2
  
  You are correct in your assumption! Using [relatedTo](http://buildwithcraft.com/docs/relations#the-relatedTo-param) with the associated field:
  
  ```
  {% set entries_fields = craft.entries.section('blog').relatedTo({
      sourceElement: entry,
      field: 'fieldHandle'
  }) %}
  
  ```
  
  Note that `field` can be the field handle of your Entries Field but it can also be a field ID.
  
  > **Comments:**
  > **username_0**: If I enter the fieldHandle of the 'field-entries' field there is still every entry displayed. I guess I have a mess between when to trigger the blog section and when the Bla section.  
  > **username_1**: Are you entering `field-entries` as your field handle? I'm pretty sure that field handles can't have "hyphens" in them. `field-` is something that craft prepends. Go to Settings > Fields > Field Type and find the handle of your field. This is what you should enter in the example above  
  
  ---
  
  