Output of matrix field twice in one template I have a matrix field with with multiple types. In a template I want to loop through all of the entries of that matrix field as you normally would. However, I also want to access a bit of data from a specific type and I can not figure out how to do it. Very frustrating. Definitely would have been a no brainer to do in craft 2.5.
The matrix field has a type of &quot;Instructor&quot; which is an entry type. The entry has a field of &quot;FullName&quot;.
So I want to say, if there is an entry type of Instructors in the matrix field, then output the full name of each entry selected in the matrix field of type &quot;Instructor&quot;.
I've tried various methods based on the matrix blocks documentation and nothing works. The closest I get is the ID of the matrix field entry. Here is one example that should explain what I'm attempting to do.
  {% set classBlocks = entry.classBlocks %}
  {% if classBlocks|length %}
    {% set instructors = clone(classBlocks).type('instructors').all() %}
    by &lt;strong&gt;
      {% for instructor in instructors %}
        {% if not loop.first %}, {% endif %}
        {{ instructor.fullName }}
      {% endfor %}
    &lt;/strong&gt;
  {% endif %}

Is this even possible? Seems pretty simple. At least in craft 2.5 I could have just looped through the matrix field and if the type was 'instructors' loop through the instructor entries outputting their full name.
Here's how I would approach this...
{% set classBlocks = entry.classBlocks.all() %}

{% if classBlocks | length %}
    {% set instructors = classBlocks | filter(block =&gt; block.type == 'instructors') %}
    by &lt;strong&gt;{{ instructors | map(instructor =&gt; instructor.fullName) | join(', ', ', and ') }}&lt;/strong&gt;
{% endif %}

We're using several filters here to achieve what I think you're trying to achieve:

| filter is used to filter just the instructor blocks out of all your class blocks; this saves us from having to do the cloning and extra query mess and is more performant.
| map is used to take our array of instructor blocks and return an array containing just their names.
| join is used to take the array of names and create a nice readable list (I find it cleaner than doing the loop checking like you're doing) - e.g. &quot;Bob, Matt, and Susy&quot;

Let me know in the comments if you have any questions or if I'm not understanding the question correctly!