Answers.Body: <p>Related entries in a matrix field are technically related to the matrix block and not the entry. So you will first want to get the related entries via <code>relatedTo(block)</code>; then loop through the related entries to get the field values.</p>
  
  <pre><code>{% for block in entry.menuLinks %}
      {% set relatedEntries = craft.entries.section('SectionName').relatedTo(block) %}
      {% for entry in relatedEntries %}
          &lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;
      {% endfor %}
  {% endfor %}
  </code></pre>
  
  <p>If you know there is one and only one block or related entry then you can skip the <code>for..in</code> loop(s) and just use the <code>.first()</code> method (i.e. <code>entry.menuLinks.first()</code> and or  <code>craft.entries.section('SectionName').relatedTo(block).first()</code>);</p>
  
  <p>Keep in mind that if you are just trying to create a simple list of links to related entries you do not need a matrix field at all (unless of course you are doing something more complicated). The Entries Field Type itself can support an unlimited number of related entries (and are sortable), so you could just create an <code>entries</code> field directly in <code>programs</code>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-04T08:06:44.663Z
Answers.Text: @DouglasMcDonald What if in the reverse way?
  Use entry to located the related matrix block in other single.
Answers.UserDisplayName: Hs Tung
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-04T13:30:01.700Z
Answers.Text: Yes you're right, not sure why I complicated it. Making it just a related entries field worked perfect. Thank you!
Answers.UserDisplayName: user3818623
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-04T15:22:13.280Z
Answers.Text: Great! I thought you might be, but wasn't sure. As a side-note... make sure and delete the matrix field, and create a new field for the related entries vs just changing the field type to entries. If you change a field type from matrix to something else it will not delete the matrix tables in the database and may create orphaned records. If you already changed it then you might want to change it back to a matrix, then delete it (i.e. it must be a matrix field and have the correct handle for it to trigger the DB cleanup on delete). Then create your new entries field.
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-04T22:41:53.523Z
Answers.Text: wow - I hope you reported that little snivel for scheduled attention by the grues Inc....
Answers.UserDisplayName: narration_sd
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-04T22:48:01.923Z
Answers.Text: I did. They are aware, and helped me clean up my DB. I think a more permanent fix is in the works.
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-04T05:26:00.910Z
Answers.LastActivityDate: 2014-11-04T05:47:09.223Z
Answers.LastEditDate: 2014-11-04T05:47:09.223Z
Answers.UserDisplayName: Douglas McDonald
Body: <p>I have a matrix field with one block type. In that block type, I have one field that is a related entries field.</p>
  
  <p>How do I access the title from the related entries field from the matrix field?</p>
  
  <p>Here is the setup I have:</p>
  
  <p>Entry name is programs
  In that entry I have a matrix block with handle name menuLinks
  In that block, the related entries field name is called menuLink.</p>
  
  <p>Thanks</p>
  
Tags: <matrix><entries-field>
Title: Get related entries from matrix field
ThreadText: # Get related entries from matrix field
  
  (Asked by: username_0 on 2014-11-04)
  
  I have a matrix field with one block type. In that block type, I have one field that is a related entries field.
  
  How do I access the title from the related entries field from the matrix field?
  
  Here is the setup I have:
  
  Entry name is programs
  In that entry I have a matrix block with handle name menuLinks
  In that block, the related entries field name is called menuLink.
  
  Thanks
  
  **Tags:** matrix, entries-field
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-11-04. Score: 7 | Accepted answer
  
  Related entries in a matrix field are technically related to the matrix block and not the entry. So you will first want to get the related entries via `relatedTo(block)`; then loop through the related entries to get the field values.
  
  ```
  {% for block in entry.menuLinks %}
      {% set relatedEntries = craft.entries.section('SectionName').relatedTo(block) %}
      {% for entry in relatedEntries %}
          <a href="{{ entry.url }}">{{ entry.title }}</a>
      {% endfor %}
  {% endfor %}
  
  ```
  
  If you know there is one and only one block or related entry then you can skip the `for..in` loop(s) and just use the `.first()` method (i.e. `entry.menuLinks.first()` and or `craft.entries.section('SectionName').relatedTo(block).first()`);
  
  Keep in mind that if you are just trying to create a simple list of links to related entries you do not need a matrix field at all (unless of course you are doing something more complicated). The Entries Field Type itself can support an unlimited number of related entries (and are sortable), so you could just create an `entries` field directly in `programs`.
  
  > **Comments:**
  > **username_0**: Yes you're right, not sure why I complicated it. Making it just a related entries field worked perfect. Thank you!  
  > **username_1**: Great! I thought you might be, but wasn't sure. As a side-note... make sure and delete the matrix field, and create a new field for the related entries vs just changing the field type to entries. If you change a field type from matrix to something else it will not delete the matrix tables in the database and may create orphaned records. If you already changed it then you might want to change it back to a matrix, then delete it (i.e. it must be a matrix field and have the correct handle for it to trigger the DB cleanup on delete). Then create your new entries field.  
  > **username_3**: wow - I hope you reported that little snivel for scheduled attention by the grues Inc....  
  > **username_1**: I did. They are aware, and helped me clean up my DB. I think a more permanent fix is in the works.  
  > **username_2**: @username_1 What if in the reverse way? Use entry to located the related matrix block in other single.  
  
  ---
  
  